From f99b338e6196bea34fb25706e657ecc040a82231 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 10 Feb 2015 11:22:27 -0600 Subject: [PATCH 001/106] MAGETWO-33887: Create SPI interfaces and context class - implemented SPI for install and upgrade and module context interface --- .../Framework/Setup/InstallDataInterface.php | 23 ++++++++++++ .../Setup/InstallSchemaInterface.php | 22 +++++++++++ .../Setup/ModuleContextInterface.php | 19 ++++++++++ .../Framework/Setup/UpgradeDataInterface.php | 23 ++++++++++++ .../Setup/UpgradeSchemaInterface.php | 23 ++++++++++++ .../src/Magento/Setup/Model/ModuleContext.php | 37 +++++++++++++++++++ 6 files changed, 147 insertions(+) create mode 100644 lib/internal/Magento/Framework/Setup/InstallDataInterface.php create mode 100644 lib/internal/Magento/Framework/Setup/InstallSchemaInterface.php create mode 100644 lib/internal/Magento/Framework/Setup/ModuleContextInterface.php create mode 100644 lib/internal/Magento/Framework/Setup/UpgradeDataInterface.php create mode 100644 lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php create mode 100644 setup/src/Magento/Setup/Model/ModuleContext.php diff --git a/lib/internal/Magento/Framework/Setup/InstallDataInterface.php b/lib/internal/Magento/Framework/Setup/InstallDataInterface.php new file mode 100644 index 0000000000000..9ec1cd52a8cac --- /dev/null +++ b/lib/internal/Magento/Framework/Setup/InstallDataInterface.php @@ -0,0 +1,23 @@ +version = $version; + } + + /** + * {@inheritdoc} + */ + public function getVersion() + { + return $this->version; + } +} From 811e190e3301e38be3b3e1eaa20873b194b8fcb9 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 10 Feb 2015 11:49:12 -0600 Subject: [PATCH 002/106] MAGETWO-33887: Create SPI interfaces and context class - added interface for module DB resource -- used in DB schema install/upgrades for DB operations --- .../adminnotification_setup/install-2.0.0.php | 2 +- .../sql/authorization_setup/install-2.0.0.php | 2 +- .../sql/captcha_setup/install-2.0.0.php | 2 +- .../install-2.0.0.php | 2 +- .../Cms/sql/cms_setup/install-2.0.0.php | 2 +- .../Core/sql/core_setup/install-2.0.0.php | 2 +- .../Cron/sql/cron_setup/install-2.0.0.php | 2 +- .../sql/customer_setup/install-2.0.0.php | 2 +- .../customer_setup/upgrade-2.0.0-2.0.0.1.php | 2 +- .../sql/designeditor_setup/install-2.0.0.php | 2 +- .../sql/directory_setup/install-2.0.0.php | 2 +- .../Eav/sql/eav_setup/install-2.0.0.php | 2 +- .../Email/sql/email_setup/install-2.0.0.php | 2 +- .../sql/giftmessage_setup/install-2.0.0.php | 2 +- .../sql/integration_setup/install-2.0.0.php | 2 +- .../Log/sql/log_setup/install-2.0.0.php | 2 +- .../offlineshipping_setup/install-2.0.0.php | 2 +- .../sql/persistent_setup/install-2.0.0.php | 2 +- .../sql/productalert_setup/install-2.0.0.php | 2 +- .../sql/sendfriend_setup/install-2.0.0.php | 2 +- .../sql/sitemap_setup/install-2.0.0.php | 2 +- .../Store/sql/store_setup/install-2.0.0.php | 2 +- .../Tax/sql/tax_setup/install-2.0.0.php | 2 +- .../Theme/sql/theme_setup/install-2.0.0.php | 2 +- .../sql/theme_setup/upgrade-2.0.0-2.0.1.php | 2 +- .../sql/translation_setup/install-2.0.0.php | 2 +- .../User/sql/user_setup/install-2.0.0.php | 2 +- .../Weee/sql/weee_setup/install-2.0.0.php | 2 +- .../sql/weee_setup/upgrade-2.0.0-2.0.0.1.php | 2 +- .../Widget/sql/widget_setup/install-2.0.0.php | 2 +- .../sql/wishlist_setup/install-2.0.0.php | 2 +- .../Magento/Framework/Module/DataSetup.php | 32 +++--- .../Module/Updater/SetupInterface.php | 5 +- .../Setup/InstallSchemaInterface.php | 4 +- .../Setup/ModuleResourceInterface.php | 103 ++++++++++++++++++ .../Setup/UpgradeSchemaInterface.php | 4 +- .../src/Magento/Setup/Module/SetupFactory.php | 3 +- .../src/Magento/Setup/Module/SetupModule.php | 17 +-- 38 files changed, 168 insertions(+), 62 deletions(-) create mode 100644 lib/internal/Magento/Framework/Setup/ModuleResourceInterface.php diff --git a/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php b/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php index f11bacec562c1..b60add2290928 100644 --- a/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php +++ b/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php @@ -10,7 +10,7 @@ * @author Magento Core Team */ -/** @var $installer \Magento\Setup\Module\SetupModule */ +/** @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php b/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php index b8b717aa9aa4a..1f8e863fd2f37 100644 --- a/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php +++ b/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php b/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php index 3f79261e7e6f5..cd7e33b72cdb2 100644 --- a/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php +++ b/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php b/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php index ce12bbcbcf2cf..45c2981655ad4 100644 --- a/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php +++ b/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php b/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php index cf84b771dd0a0..86951a8f2f511 100644 --- a/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php +++ b/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/install-2.0.0.php b/app/code/Magento/Core/sql/core_setup/install-2.0.0.php index b9ae57c745961..7ff8b2bd1e4b8 100644 --- a/app/code/Magento/Core/sql/core_setup/install-2.0.0.php +++ b/app/code/Magento/Core/sql/core_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; /* @var $connection \Magento\Framework\DB\Adapter\AdapterInterface */ diff --git a/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php b/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php index b334cf9b26d26..b53c62dd6c725 100644 --- a/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php +++ b/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php b/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php index 30043a76224d5..0df0cc8bc8da1 100644 --- a/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php +++ b/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php b/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php index a442eb533aa4b..7b82f177c0b34 100644 --- a/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php +++ b/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); $connection = $installer->getConnection(); diff --git a/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php b/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php index bba9b808815da..f4c675eace7e5 100644 --- a/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php +++ b/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php b/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php index d9a669a498622..77108b262f69d 100644 --- a/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php +++ b/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php b/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php index c4acb1c50fd81..2ba8bb77cca35 100644 --- a/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php +++ b/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Email/sql/email_setup/install-2.0.0.php b/app/code/Magento/Email/sql/email_setup/install-2.0.0.php index e799238345c73..94666d267e2fa 100644 --- a/app/code/Magento/Email/sql/email_setup/install-2.0.0.php +++ b/app/code/Magento/Email/sql/email_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; /** diff --git a/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php b/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php index 09a6303e81990..a69711c4e7585 100644 --- a/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php +++ b/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Setup\Module\SetupModule */ +/** @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php b/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php index 7ead4e8b05f67..cae732e108209 100644 --- a/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php +++ b/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php @@ -6,7 +6,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Log/sql/log_setup/install-2.0.0.php b/app/code/Magento/Log/sql/log_setup/install-2.0.0.php index 30c25abbcf7d4..ef4b6b8b92c93 100644 --- a/app/code/Magento/Log/sql/log_setup/install-2.0.0.php +++ b/app/code/Magento/Log/sql/log_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php index 578f6ec469c2a..53b8c0945213d 100644 --- a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php +++ b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Setup\Module\SetupModule */ +/** @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php b/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php index ca5b097b1be7d..9ed68eb0f9ce9 100644 --- a/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php +++ b/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Setup\Module\SetupModule */ +/** @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php b/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php index 8513f5c12729c..17ebba9fc2266 100644 --- a/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php +++ b/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php @@ -10,7 +10,7 @@ * @author Magento Core Team */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php b/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php index 15a039f3b1361..b01e2046ae489 100644 --- a/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php +++ b/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php b/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php index 8ab702ec5ec90..94f2d64637ae2 100644 --- a/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php +++ b/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Store/sql/store_setup/install-2.0.0.php b/app/code/Magento/Store/sql/store_setup/install-2.0.0.php index ce0c3274b8425..5272896225019 100644 --- a/app/code/Magento/Store/sql/store_setup/install-2.0.0.php +++ b/app/code/Magento/Store/sql/store_setup/install-2.0.0.php @@ -6,7 +6,7 @@ use Magento\Framework\DB\Ddl\Table; -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php b/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php index 8c9dcd18f5c83..a28f82979c96f 100644 --- a/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php +++ b/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Setup\Module\SetupModule */ +/** @var $this \Magento\Framework\Setup\ModuleResourceInterface */ $this->startSetup(); /** diff --git a/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php b/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php index 17fa614e28230..f475fd43c9a04 100644 --- a/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php +++ b/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; /* @var $connection \Magento\Framework\DB\Adapter\AdapterInterface */ diff --git a/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php b/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php index b521db97a3ff9..884f95fe50dcd 100644 --- a/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php +++ b/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php b/app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php index 4d9f443072d76..d130c1d1c9400 100644 --- a/app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php +++ b/app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/User/sql/user_setup/install-2.0.0.php b/app/code/Magento/User/sql/user_setup/install-2.0.0.php index fb8d7e63b9bcf..6ea82012c4ea5 100644 --- a/app/code/Magento/User/sql/user_setup/install-2.0.0.php +++ b/app/code/Magento/User/sql/user_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php b/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php index 79db55b72f0a1..e826c2c51d96d 100644 --- a/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php +++ b/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Setup\Module\SetupModule */ +/** @var $this \Magento\Framework\Setup\ModuleResourceInterface */ $this->startSetup(); /** * Create table 'weee_tax' diff --git a/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php b/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php index eefa27219ff2b..ae534c3e3686c 100644 --- a/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php +++ b/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php @@ -5,7 +5,7 @@ */ $installer = $this; -/** @var $installer \Magento\Setup\Module\SetupModule */ +/** @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer->startSetup(); $connection = $installer->getConnection(); diff --git a/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php b/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php index 3f91b5008df1e..c6d931b70b567 100644 --- a/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php +++ b/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php b/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php index 8d30ddbd7b30b..7ada08098e4a8 100644 --- a/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php +++ b/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php @@ -6,7 +6,7 @@ // @codingStandardsIgnoreFile -/* @var $installer \Magento\Setup\Module\SetupModule */ +/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/lib/internal/Magento/Framework/Module/DataSetup.php b/lib/internal/Magento/Framework/Module/DataSetup.php index 59f5981a44f9a..3a09eed3c42c3 100644 --- a/lib/internal/Magento/Framework/Module/DataSetup.php +++ b/lib/internal/Magento/Framework/Module/DataSetup.php @@ -15,21 +15,21 @@ class DataSetup extends \Magento\Framework\Module\Setup implements \Magento\Fram * Setup resource name * @var string */ - protected $_resourceName; + private $_resourceName; /** * Setup module configuration object * * @var array */ - protected $_moduleConfig; + private $_moduleConfig; /** * Call afterApplyAllUpdates method flag * * @var boolean */ - protected $_callAfterApplyAllUpdates = false; + private $_callAfterApplyAllUpdates = false; /** * Tables data cache array @@ -43,39 +43,39 @@ class DataSetup extends \Magento\Framework\Module\Setup implements \Magento\Fram * * @var \Magento\Framework\Module\Dir\Reader */ - protected $_modulesReader; + private $_modulesReader; /** * @var \Magento\Framework\Event\ManagerInterface */ - protected $_eventManager; + private $_eventManager; /** * @var \Psr\Log\LoggerInterface */ - protected $_logger; + private $_logger; /** * @var \Magento\Framework\Module\ResourceInterface */ - protected $_resource; + private $_resource; /** * @var \Magento\Framework\Module\Setup\MigrationFactory */ - protected $_migrationFactory; + private $_migrationFactory; /** * Filesystem instance * * @var \Magento\Framework\Filesystem */ - protected $filesystem; + private $filesystem; /** * @var \Magento\Framework\Filesystem\Directory\ReadInterface */ - protected $modulesDir; + private $modulesDir; /** * @param \Magento\Framework\Module\Setup\Context $context @@ -127,7 +127,7 @@ public function applyDataUpdates() * @param string $newVersion * @return $this */ - protected function _installData($newVersion) + private function _installData($newVersion) { $oldVersion = $this->_modifyResourceDb(self::TYPE_DATA_INSTALL, '', $newVersion); $this->_modifyResourceDb(self::TYPE_DATA_UPGRADE, $oldVersion, $newVersion); @@ -143,7 +143,7 @@ protected function _installData($newVersion) * @param string $newVersion * @return $this */ - protected function _upgradeData($oldVersion, $newVersion) + private function _upgradeData($oldVersion, $newVersion) { $this->_modifyResourceDb('data-upgrade', $oldVersion, $newVersion); $this->_resource->setDataVersion($this->_resourceName, $newVersion); @@ -159,7 +159,7 @@ protected function _upgradeData($oldVersion, $newVersion) * @param string $toVersion * @return array */ - protected function _getAvailableDataFiles($actionType, $fromVersion, $toVersion) + private function _getAvailableDataFiles($actionType, $fromVersion, $toVersion) { $modName = (string)$this->_moduleConfig['name']; $files = []; @@ -191,7 +191,7 @@ protected function _getAvailableDataFiles($actionType, $fromVersion, $toVersion) * @return false|string * @throws \Magento\Framework\Exception */ - protected function _modifyResourceDb($actionType, $fromVersion, $toVersion) + private function _modifyResourceDb($actionType, $fromVersion, $toVersion) { $files = $this->_getAvailableDataFiles($actionType, $fromVersion, $toVersion); if (empty($files) || !$this->getConnection()) { @@ -250,7 +250,7 @@ protected function _modifyResourceDb($actionType, $fromVersion, $toVersion) * @param string $fileName * @return mixed */ - protected function _includeFile($fileName) + private function _includeFile($fileName) { return include $fileName; } @@ -265,7 +265,7 @@ protected function _includeFile($fileName) * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles) + private function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles) { $arrRes = []; switch ($actionType) { diff --git a/lib/internal/Magento/Framework/Module/Updater/SetupInterface.php b/lib/internal/Magento/Framework/Module/Updater/SetupInterface.php index 83b8cba864051..c8158327ab352 100644 --- a/lib/internal/Magento/Framework/Module/Updater/SetupInterface.php +++ b/lib/internal/Magento/Framework/Module/Updater/SetupInterface.php @@ -1,12 +1,13 @@ moduleConfig['name']; $dbFiles = []; @@ -166,7 +167,7 @@ public function applyUpdates() * @return false|string * @throws \Exception */ - protected function applySchemaUpdates($actionType, $fromVersion, $toVersion) + private function applySchemaUpdates($actionType, $fromVersion, $toVersion) { $files = $this->getAvailableDbFiles($actionType, $fromVersion, $toVersion); @@ -211,7 +212,7 @@ protected function applySchemaUpdates($actionType, $fromVersion, $toVersion) * @param array $arrFiles * @return array */ - protected function prepareUpgradeFileCollection($actionType, $fromVersion, $toVersion, $arrFiles) + private function prepareUpgradeFileCollection($actionType, $fromVersion, $toVersion, $arrFiles) { $arrRes = []; switch ($actionType) { From 497d5f478633667e71d9ef7fc8f49fdcda74af25 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 10 Feb 2015 12:27:44 -0600 Subject: [PATCH 003/106] MAGETWO-33887: Create SPI interfaces and context class - added interface for module DB data resource -- used in DB data install/upgrades for DB operations --- .../adminnotification_setup/install-2.0.0.php | 2 +- .../Authorization/Model/Resource/Setup.php | 3 +- .../sql/authorization_setup/install-2.0.0.php | 2 +- .../sql/captcha_setup/install-2.0.0.php | 2 +- .../Magento/Catalog/Model/Resource/Setup.php | 4 +- .../catalogrule_setup/data-install-2.0.0.php | 2 +- .../Magento/Checkout/Model/Resource/Setup.php | 4 +- .../install-2.0.0.php | 2 +- app/code/Magento/Cms/Model/Resource/Setup.php | 3 +- .../Cms/sql/cms_setup/install-2.0.0.php | 2 +- .../data/core_setup/data-install-2.0.0.php | 2 +- app/code/Magento/Core/etc/di.xml | 4 +- .../Core/sql/core_setup/install-2.0.0.php | 2 +- .../Cron/sql/cron_setup/install-2.0.0.php | 2 +- .../Magento/Customer/Model/Resource/Setup.php | 4 +- .../sql/customer_setup/install-2.0.0.php | 2 +- .../customer_setup/upgrade-2.0.0-2.0.0.1.php | 2 +- .../sql/designeditor_setup/install-2.0.0.php | 2 +- app/code/Magento/Dhl/Model/Resource/Setup.php | 4 +- .../Directory/Model/Resource/Setup.php | 4 +- .../sql/directory_setup/install-2.0.0.php | 2 +- app/code/Magento/Eav/Model/Entity/Setup.php | 3 +- .../Eav/sql/eav_setup/install-2.0.0.php | 2 +- .../Email/sql/email_setup/install-2.0.0.php | 2 +- .../data/fedex_setup/data-install-2.0.0.php | 4 +- .../GiftMessage/Model/Resource/Setup.php | 4 +- .../sql/giftmessage_setup/install-2.0.0.php | 2 +- .../GoogleShopping/Model/Resource/Setup.php | 4 +- .../Integration/Model/Resource/Setup.php | 3 +- .../sql/integration_setup/install-2.0.0.php | 2 +- .../data/log_setup/data-install-1.6.0.0.php | 2 +- .../Log/sql/log_setup/install-2.0.0.php | 2 +- .../offlineshipping_setup/install-2.0.0.php | 2 +- .../sql/persistent_setup/install-2.0.0.php | 2 +- .../sql/productalert_setup/install-2.0.0.php | 2 +- .../Magento/Quote/Model/Resource/Setup.php | 3 +- .../Magento/Reports/Model/Resource/Setup.php | 4 +- .../data/review_setup/data-install-2.0.0.php | 2 +- .../Magento/Sales/Model/Resource/Setup.php | 3 +- .../salesrule_setup/data-install-2.0.0.php | 2 +- .../sql/sendfriend_setup/install-2.0.0.php | 2 +- .../sql/sitemap_setup/install-2.0.0.php | 2 +- .../Store/sql/store_setup/install-2.0.0.php | 2 +- app/code/Magento/Tax/Model/Resource/Setup.php | 3 +- .../Tax/sql/tax_setup/install-2.0.0.php | 2 +- .../Magento/Theme/Model/Resource/Setup.php | 3 +- .../Theme/sql/theme_setup/install-2.0.0.php | 2 +- .../sql/theme_setup/upgrade-2.0.0-2.0.1.php | 2 +- .../sql/translation_setup/install-2.0.0.php | 2 +- .../User/sql/user_setup/install-2.0.0.php | 2 +- .../data/usps_setup/data-install-2.0.0.php | 2 +- .../Magento/Weee/Model/Resource/Setup.php | 3 +- .../Weee/sql/weee_setup/install-2.0.0.php | 2 +- .../sql/weee_setup/upgrade-2.0.0-2.0.0.1.php | 2 +- .../data/widget_setup/data-install-2.0.0.php | 2 +- .../Widget/sql/widget_setup/install-2.0.0.php | 2 +- .../sql/wishlist_setup/install-2.0.0.php | 2 +- .../Framework/Module/DataSetupTest.php | 4 +- .../Test/Legacy/_files/obsolete_methods.php | 4 +- .../Module/Updater/SetupFactoryTest.php | 4 +- .../Magento/Tools/Migration/themes_view.php | 2 +- .../Magento/Framework/Module/DataSetup.php | 5 +- .../Framework/Module/DbVersionInfo.php | 4 +- .../Magento/Framework/Module/Manager.php | 3 - .../Magento/Framework/Module/Setup.php | 7 +- .../Framework/Module/Setup/Migration.php | 3 +- .../Framework/Module/Updater/SetupFactory.php | 9 +- .../Module/Updater/SetupInterface.php | 46 -------- .../Framework/Setup/InstallDataInterface.php | 4 +- .../Setup/InstallSchemaInterface.php | 6 +- .../Setup/ModuleDataResourceInterface.php | 102 ++++++++++++++++++ .../Setup/ModuleSchemaResourceInterface.php | 27 +++++ ...rceInterface.php => ResourceInterface.php} | 38 +------ .../Setup/SchemaResourceInterface.php | 33 ++++++ .../Framework/Setup/UpgradeDataInterface.php | 4 +- .../Setup/UpgradeSchemaInterface.php | 6 +- setup/src/Magento/Setup/Module/Setup.php | 4 +- .../src/Magento/Setup/Module/SetupFactory.php | 4 +- .../src/Magento/Setup/Module/SetupModule.php | 8 +- 79 files changed, 289 insertions(+), 181 deletions(-) delete mode 100644 lib/internal/Magento/Framework/Module/Updater/SetupInterface.php create mode 100644 lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php create mode 100644 lib/internal/Magento/Framework/Setup/ModuleSchemaResourceInterface.php rename lib/internal/Magento/Framework/Setup/{ModuleResourceInterface.php => ResourceInterface.php} (54%) create mode 100644 lib/internal/Magento/Framework/Setup/SchemaResourceInterface.php diff --git a/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php b/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php index b60add2290928..b602490e32a78 100644 --- a/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php +++ b/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php @@ -10,7 +10,7 @@ * @author Magento Core Team */ -/** @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Authorization/Model/Resource/Setup.php b/app/code/Magento/Authorization/Model/Resource/Setup.php index 8fa3d444d84f4..d93488a18bf23 100644 --- a/app/code/Magento/Authorization/Model/Resource/Setup.php +++ b/app/code/Magento/Authorization/Model/Resource/Setup.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Authorization\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Resource Setup Model @@ -59,7 +60,7 @@ public function __construct( \Magento\Authorization\Model\RoleFactory $roleFactory, \Magento\Authorization\Model\RulesFactory $rulesFactory, $moduleName = 'Magento_Authorization', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_roleCollectionFactory = $roleCollectionFactory; $this->_rulesCollectionFactory = $rulesCollectionFactory; diff --git a/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php b/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php index 1f8e863fd2f37..2ae09848561c4 100644 --- a/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php +++ b/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php b/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php index cd7e33b72cdb2..327b2963c6745 100644 --- a/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php +++ b/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Catalog/Model/Resource/Setup.php b/app/code/Magento/Catalog/Model/Resource/Setup.php index a32005ec5a719..e71ba40a33a0a 100644 --- a/app/code/Magento/Catalog/Model/Resource/Setup.php +++ b/app/code/Magento/Catalog/Model/Resource/Setup.php @@ -7,6 +7,8 @@ */ namespace Magento\Catalog\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; + class Setup extends \Magento\Eav\Model\Entity\Setup { /** @@ -41,7 +43,7 @@ public function __construct( \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeResourceFactory, $moduleName = 'Magento_Catalog', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_categoryFactory = $categoryFactory; $this->_eavAttributeResourceFactory = $eavAttributeResourceFactory; diff --git a/app/code/Magento/CatalogRule/data/catalogrule_setup/data-install-2.0.0.php b/app/code/Magento/CatalogRule/data/catalogrule_setup/data-install-2.0.0.php index a8c56d8d64d35..23d9fc6acdb60 100644 --- a/app/code/Magento/CatalogRule/data/catalogrule_setup/data-install-2.0.0.php +++ b/app/code/Magento/CatalogRule/data/catalogrule_setup/data-install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Framework\Module\DataSetup */ +/** @var $this \Magento\Framework\Setup\ModuleDataResourceInterface */ $installer = $this->createMigrationSetup(); $installer->startSetup(); diff --git a/app/code/Magento/Checkout/Model/Resource/Setup.php b/app/code/Magento/Checkout/Model/Resource/Setup.php index f6062647b4f11..88b81a9a2b793 100644 --- a/app/code/Magento/Checkout/Model/Resource/Setup.php +++ b/app/code/Magento/Checkout/Model/Resource/Setup.php @@ -7,6 +7,8 @@ */ namespace Magento\Checkout\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; + class Setup extends \Magento\Eav\Model\Entity\Setup { /** @@ -30,7 +32,7 @@ public function __construct( \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Customer\Helper\Address $customerAddress, $moduleName = 'Magento_Checkout', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_customerAddress = $customerAddress; parent::__construct( diff --git a/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php b/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php index 45c2981655ad4..2e60539147c3a 100644 --- a/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php +++ b/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Cms/Model/Resource/Setup.php b/app/code/Magento/Cms/Model/Resource/Setup.php index 5ea1de0e5a6b5..4a6c1e1dc4b46 100644 --- a/app/code/Magento/Cms/Model/Resource/Setup.php +++ b/app/code/Magento/Cms/Model/Resource/Setup.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Cms\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Cms resource setup @@ -38,7 +39,7 @@ public function __construct( \Magento\Cms\Model\BlockFactory $blockFactory, \Magento\Cms\Model\PageFactory $pageFactory, $moduleName = 'Magento_Cms', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_blockFactory = $blockFactory; $this->_pageFactory = $pageFactory; diff --git a/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php b/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php index 86951a8f2f511..f6fbbde761173 100644 --- a/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php +++ b/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php b/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php index f63086dd9f7af..e1f62c89ec61b 100644 --- a/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php +++ b/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Framework\Module\DataSetup */ +/** @var $this \Magento\Framework\Setup\ModuleDataResourceInterface */ $installer = $this->createMigrationSetup(); $installer->startSetup(); diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index 751643e14c78d..34a6500a19055 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -8,7 +8,7 @@ - + @@ -434,7 +434,7 @@ app/etc/aliases_to_classes_map.json core_setup Magento_Core - \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + \Magento\Framework\Setup\ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION diff --git a/app/code/Magento/Core/sql/core_setup/install-2.0.0.php b/app/code/Magento/Core/sql/core_setup/install-2.0.0.php index 7ff8b2bd1e4b8..2c5e75d5b54b3 100644 --- a/app/code/Magento/Core/sql/core_setup/install-2.0.0.php +++ b/app/code/Magento/Core/sql/core_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; /* @var $connection \Magento\Framework\DB\Adapter\AdapterInterface */ diff --git a/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php b/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php index b53c62dd6c725..9e18182db0e84 100644 --- a/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php +++ b/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Customer/Model/Resource/Setup.php b/app/code/Magento/Customer/Model/Resource/Setup.php index 3e1f8da9666f5..1349edde16291 100644 --- a/app/code/Magento/Customer/Model/Resource/Setup.php +++ b/app/code/Magento/Customer/Model/Resource/Setup.php @@ -7,6 +7,8 @@ */ namespace Magento\Customer\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; + class Setup extends \Magento\Eav\Model\Entity\Setup { /** @@ -30,7 +32,7 @@ public function __construct( \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Eav\Model\Config $eavConfig, $moduleName = 'Magento_Customer', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_eavConfig = $eavConfig; parent::__construct( diff --git a/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php b/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php index 0df0cc8bc8da1..80b5050822741 100644 --- a/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php +++ b/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php b/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php index 7b82f177c0b34..007591d1c07fc 100644 --- a/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php +++ b/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); $connection = $installer->getConnection(); diff --git a/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php b/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php index f4c675eace7e5..a92136ede3cbf 100644 --- a/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php +++ b/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Dhl/Model/Resource/Setup.php b/app/code/Magento/Dhl/Model/Resource/Setup.php index 7e61a01954e6d..012ba3cdde645 100644 --- a/app/code/Magento/Dhl/Model/Resource/Setup.php +++ b/app/code/Magento/Dhl/Model/Resource/Setup.php @@ -5,6 +5,8 @@ */ namespace Magento\Dhl\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; + class Setup extends \Magento\Framework\Module\DataSetup { /** @@ -24,7 +26,7 @@ public function __construct( $resourceName, $moduleName, \Magento\Framework\Locale\ListsInterface $localeLists, - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_localeLists = $localeLists; parent::__construct($context, $resourceName, $moduleName, $connectionName); diff --git a/app/code/Magento/Directory/Model/Resource/Setup.php b/app/code/Magento/Directory/Model/Resource/Setup.php index bebd754c526ae..ab7673d6c4e56 100644 --- a/app/code/Magento/Directory/Model/Resource/Setup.php +++ b/app/code/Magento/Directory/Model/Resource/Setup.php @@ -11,6 +11,8 @@ */ namespace Magento\Directory\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; + class Setup extends \Magento\Framework\Module\DataSetup { /** @@ -30,7 +32,7 @@ public function __construct( $resourceName, \Magento\Directory\Helper\Data $directoryData, $moduleName = 'Magento_Directory', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_directoryData = $directoryData; parent::__construct($context, $resourceName, $moduleName, $connectionName); diff --git a/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php b/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php index 77108b262f69d..2440cdb73334e 100644 --- a/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php +++ b/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Eav/Model/Entity/Setup.php b/app/code/Magento/Eav/Model/Entity/Setup.php index d2d6a1fc1754e..0bd311e5de5db 100644 --- a/app/code/Magento/Eav/Model/Entity/Setup.php +++ b/app/code/Magento/Eav/Model/Entity/Setup.php @@ -6,6 +6,7 @@ * See COPYING.txt for license details. */ namespace Magento\Eav\Model\Entity; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -41,7 +42,7 @@ public function __construct( \Magento\Framework\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, $moduleName = 'Magento_Eav', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_cache = $cache; $this->_attrGroupCollectionFactory = $attrGroupCollectionFactory; diff --git a/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php b/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php index 2ba8bb77cca35..70cb7bb46fcd3 100644 --- a/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php +++ b/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Email/sql/email_setup/install-2.0.0.php b/app/code/Magento/Email/sql/email_setup/install-2.0.0.php index 94666d267e2fa..6061efbdfad19 100644 --- a/app/code/Magento/Email/sql/email_setup/install-2.0.0.php +++ b/app/code/Magento/Email/sql/email_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; /** diff --git a/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php b/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php index 1fb97b3edf17c..689a3116d11d3 100644 --- a/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php +++ b/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Framework\Module\DataSetup */ +/** @var $this \Magento\Framework\Setup\ModuleDataResourceInterface */ $codes = [ 'method' => [ 'EUROPEFIRSTINTERNATIONALPRIORITY' => 'EUROPE_FIRST_INTERNATIONAL_PRIORITY', @@ -46,7 +46,7 @@ ], ]; -/* @var $installer \Magento\Framework\Module\DataSetup */ +/* @var $installer \Magento\Framework\Setup\ModuleDataResourceInterface */ $installer = $this; $configDataTable = $installer->getTable('core_config_data'); $conn = $installer->getConnection(); diff --git a/app/code/Magento/GiftMessage/Model/Resource/Setup.php b/app/code/Magento/GiftMessage/Model/Resource/Setup.php index c7242c14bd061..a58c7beba1ef3 100644 --- a/app/code/Magento/GiftMessage/Model/Resource/Setup.php +++ b/app/code/Magento/GiftMessage/Model/Resource/Setup.php @@ -7,6 +7,8 @@ */ namespace Magento\GiftMessage\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; + class Setup extends \Magento\Framework\Module\DataSetup { /** @@ -40,7 +42,7 @@ public function __construct( \Magento\Quote\Model\Resource\SetupFactory $quoteSetupFactory, \Magento\Sales\Model\Resource\SetupFactory $salesSetupFactory, $moduleName = 'Magento_GiftMessage', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->catalogSetupFactory = $catalogSetupFactory; $this->quoteSetupFactory = $quoteSetupFactory; diff --git a/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php b/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php index a69711c4e7585..e3bc0351c090c 100644 --- a/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php +++ b/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Setup.php b/app/code/Magento/GoogleShopping/Model/Resource/Setup.php index 19ac8ba4976f9..a2fdead1c0483 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Setup.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Setup.php @@ -5,6 +5,8 @@ */ namespace Magento\GoogleShopping\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; + class Setup extends \Magento\Framework\Module\DataSetup { /** @@ -31,7 +33,7 @@ public function __construct( \Magento\GoogleShopping\Model\ConfigFactory $configFactory, \Magento\Framework\Module\Manager $moduleManager, $moduleName = 'Magento_GoogleShopping', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_configFactory = $configFactory; $this->moduleManager = $moduleManager; diff --git a/app/code/Magento/Integration/Model/Resource/Setup.php b/app/code/Magento/Integration/Model/Resource/Setup.php index 519b0ccbd9373..32e34d9c63814 100644 --- a/app/code/Magento/Integration/Model/Resource/Setup.php +++ b/app/code/Magento/Integration/Model/Resource/Setup.php @@ -5,6 +5,7 @@ */ namespace Magento\Integration\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; use Magento\Integration\Model\Manager; /** @@ -32,7 +33,7 @@ public function __construct( $resourceName, Manager $integrationManager, $moduleName = 'Magento_Integration', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_integrationManager = $integrationManager; parent::__construct($context, $resourceName, $moduleName, $connectionName); diff --git a/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php b/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php index cae732e108209..4a3b4c27f0d1f 100644 --- a/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php +++ b/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php @@ -6,7 +6,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php b/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php index 9343251b41e97..1f99095a925ae 100644 --- a/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php +++ b/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Module\DataSetup */ +/* @var $installer \Magento\Framework\Setup\ModuleDataResourceInterface */ $installer = $this; $data = [ diff --git a/app/code/Magento/Log/sql/log_setup/install-2.0.0.php b/app/code/Magento/Log/sql/log_setup/install-2.0.0.php index ef4b6b8b92c93..7f78dbffc920f 100644 --- a/app/code/Magento/Log/sql/log_setup/install-2.0.0.php +++ b/app/code/Magento/Log/sql/log_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php index 53b8c0945213d..309dd7f33218b 100644 --- a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php +++ b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php b/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php index 9ed68eb0f9ce9..550caa7e2b7c6 100644 --- a/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php +++ b/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php b/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php index 17ebba9fc2266..df3d7d81c69ee 100644 --- a/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php +++ b/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php @@ -10,7 +10,7 @@ * @author Magento Core Team */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Quote/Model/Resource/Setup.php b/app/code/Magento/Quote/Model/Resource/Setup.php index cce7667a77d05..8a63c491146d1 100644 --- a/app/code/Magento/Quote/Model/Resource/Setup.php +++ b/app/code/Magento/Quote/Model/Resource/Setup.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Quote\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Setup Model of Sales Module @@ -36,7 +37,7 @@ public function __construct( \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Framework\App\Config\ScopeConfigInterface $config, $moduleName = 'Magento_Quote', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_config = $config; $this->_encryptor = $context->getEncryptor(); diff --git a/app/code/Magento/Reports/Model/Resource/Setup.php b/app/code/Magento/Reports/Model/Resource/Setup.php index cba27d3cf5d5a..dd6e638356393 100644 --- a/app/code/Magento/Reports/Model/Resource/Setup.php +++ b/app/code/Magento/Reports/Model/Resource/Setup.php @@ -9,6 +9,8 @@ */ namespace Magento\Reports\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; + class Setup extends \Magento\Framework\Module\DataSetup { /** @@ -28,7 +30,7 @@ public function __construct( $resourceName, \Magento\Cms\Model\PageFactory $pageFactory, $moduleName = 'Magento_Reports', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { parent::__construct($context, $resourceName, $moduleName, $connectionName); $this->_pageFactory = $pageFactory; diff --git a/app/code/Magento/Review/data/review_setup/data-install-2.0.0.php b/app/code/Magento/Review/data/review_setup/data-install-2.0.0.php index 73a0071ededea..b31d7a7807d09 100644 --- a/app/code/Magento/Review/data/review_setup/data-install-2.0.0.php +++ b/app/code/Magento/Review/data/review_setup/data-install-2.0.0.php @@ -10,7 +10,7 @@ * @author Magento Core Team */ -/* @var $installer \Magento\Framework\Module\DataSetup */ +/* @var $installer \Magento\Framework\Setup\ModuleDataResourceInterface */ $installer = $this; //Fill table review/review_entity diff --git a/app/code/Magento/Sales/Model/Resource/Setup.php b/app/code/Magento/Sales/Model/Resource/Setup.php index 6a308344f68f9..10569012ea9f3 100644 --- a/app/code/Magento/Sales/Model/Resource/Setup.php +++ b/app/code/Magento/Sales/Model/Resource/Setup.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Sales\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Setup Model of Sales Module @@ -36,7 +37,7 @@ public function __construct( \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Framework\App\Config\ScopeConfigInterface $config, $moduleName = 'Magento_Sales', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_config = $config; $this->_encryptor = $context->getEncryptor(); diff --git a/app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php b/app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php index 7cd9b25ffe119..4c4c9fb099778 100644 --- a/app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php +++ b/app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Framework\Module\DataSetup */ +/** @var $this \Magento\Framework\Setup\ModuleDataResourceInterface */ $installer = $this->createMigrationSetup(); $installer->startSetup(); diff --git a/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php b/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php index b01e2046ae489..82d8dc589be82 100644 --- a/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php +++ b/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php b/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php index 94f2d64637ae2..25310453874fd 100644 --- a/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php +++ b/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Store/sql/store_setup/install-2.0.0.php b/app/code/Magento/Store/sql/store_setup/install-2.0.0.php index 5272896225019..5e544cc05b9ab 100644 --- a/app/code/Magento/Store/sql/store_setup/install-2.0.0.php +++ b/app/code/Magento/Store/sql/store_setup/install-2.0.0.php @@ -6,7 +6,7 @@ use Magento\Framework\DB\Ddl\Table; -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Tax/Model/Resource/Setup.php b/app/code/Magento/Tax/Model/Resource/Setup.php index 9b445678c4472..20b4b000e5916 100644 --- a/app/code/Magento/Tax/Model/Resource/Setup.php +++ b/app/code/Magento/Tax/Model/Resource/Setup.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Tax\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Tax Setup Resource Model @@ -40,7 +41,7 @@ public function __construct( \Magento\Catalog\Model\Resource\SetupFactory $setupFactory, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, $moduleName = 'Magento_Tax', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_setupFactory = $setupFactory; $this->productTypeConfig = $productTypeConfig; diff --git a/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php b/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php index a28f82979c96f..a062644369494 100644 --- a/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php +++ b/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Framework\Setup\ModuleResourceInterface */ +/** @var $this \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $this->startSetup(); /** diff --git a/app/code/Magento/Theme/Model/Resource/Setup.php b/app/code/Magento/Theme/Model/Resource/Setup.php index 7b275cb803a4e..34b58775495fb 100644 --- a/app/code/Magento/Theme/Model/Resource/Setup.php +++ b/app/code/Magento/Theme/Model/Resource/Setup.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Theme\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Core resource setup @@ -34,7 +35,7 @@ public function __construct( \Magento\Theme\Model\Resource\Theme\CollectionFactory $themeResourceFactory, \Magento\Theme\Model\Theme\CollectionFactory $themeFactory, $moduleName = 'Magento_Core', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_themeResourceFactory = $themeResourceFactory; $this->_themeFactory = $themeFactory; diff --git a/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php b/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php index f475fd43c9a04..c918656965670 100644 --- a/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php +++ b/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; /* @var $connection \Magento\Framework\DB\Adapter\AdapterInterface */ diff --git a/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php b/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php index 884f95fe50dcd..b8ce25b4f5056 100644 --- a/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php +++ b/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php b/app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php index d130c1d1c9400..dc3d9e161aeac 100644 --- a/app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php +++ b/app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/User/sql/user_setup/install-2.0.0.php b/app/code/Magento/User/sql/user_setup/install-2.0.0.php index 6ea82012c4ea5..50960ad43043f 100644 --- a/app/code/Magento/User/sql/user_setup/install-2.0.0.php +++ b/app/code/Magento/User/sql/user_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php b/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php index 5af1cef4f36ba..7eae2a1040ff7 100644 --- a/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php +++ b/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Module\DataSetup */ +/* @var $installer \Magento\Framework\Setup\ModuleDataResourceInterface */ $installer = $this; $configDataTable = $installer->getTable('core_config_data'); $connection = $installer->getConnection(); diff --git a/app/code/Magento/Weee/Model/Resource/Setup.php b/app/code/Magento/Weee/Model/Resource/Setup.php index 46bf9145aa456..f65886925f71b 100644 --- a/app/code/Magento/Weee/Model/Resource/Setup.php +++ b/app/code/Magento/Weee/Model/Resource/Setup.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Weee\Model\Resource; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Setup Model of Weee Module @@ -34,7 +35,7 @@ public function __construct( \Magento\Sales\Model\Resource\SetupFactory $salesSetupFactory, \Magento\Quote\Model\Resource\SetupFactory $quoteSetupFactory, $moduleName = 'Magento_Weee', - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->salesSetupFactory = $salesSetupFactory; $this->quoteSetupFactory = $quoteSetupFactory; diff --git a/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php b/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php index e826c2c51d96d..aa5c5328ed1f0 100644 --- a/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php +++ b/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Framework\Setup\ModuleResourceInterface */ +/** @var $this \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $this->startSetup(); /** * Create table 'weee_tax' diff --git a/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php b/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php index ae534c3e3686c..af30de861eb00 100644 --- a/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php +++ b/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php @@ -5,7 +5,7 @@ */ $installer = $this; -/** @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer->startSetup(); $connection = $installer->getConnection(); diff --git a/app/code/Magento/Widget/data/widget_setup/data-install-2.0.0.php b/app/code/Magento/Widget/data/widget_setup/data-install-2.0.0.php index cd8b76e54949b..e09107e5055f3 100644 --- a/app/code/Magento/Widget/data/widget_setup/data-install-2.0.0.php +++ b/app/code/Magento/Widget/data/widget_setup/data-install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Framework\Module\DataSetup */ +/** @var $this \Magento\Framework\Setup\ModuleDataResourceInterface */ $installer = $this->createMigrationSetup(); $installer->startSetup(); diff --git a/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php b/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php index c6d931b70b567..809b31e3951cf 100644 --- a/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php +++ b/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php b/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php index 7ada08098e4a8..4291d05b31deb 100644 --- a/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php +++ b/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php @@ -6,7 +6,7 @@ // @codingStandardsIgnoreFile -/* @var $installer \Magento\Framework\Setup\ModuleResourceInterface */ +/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php index 8454d20143355..968e5032aae6f 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php @@ -5,10 +5,12 @@ */ namespace Magento\Framework\Module; +use Magento\Framework\Setup\ModuleDataResourceInterface; + class DataSetupTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\Module\DataSetup + * @var ModuleDataResourceInterface */ protected $_model; diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 3efaaeaa5e577..b8b1fea1a7b96 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -1954,8 +1954,8 @@ ['getTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::getTableRow'], ['deleteTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::deleteTableRow'], ['updateTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::updateTableRow'], - ['getCallAfterApplyAllUpdates', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::getCallAfterApplyAllUpdates'], - ['afterApplyAllUpdates', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::afterApplyAllUpdates'], + ['getCallAfterApplyAllUpdates', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::getCallAfterApplyAllUpdates'], + ['afterApplyAllUpdates', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataResourceInterface::afterApplyAllUpdates'], ['getEventManager', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::getEventManager'], ['getFilesystem', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::getFilesystem'], ['createMigrationSetup', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::createMigrationSetup'], diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php index 911fa476d471e..8e6da7e4d5c1c 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php @@ -27,7 +27,7 @@ public function testCreateUsesDefaultSetupModelClassIfSetupModelIsNotDeclaredFor $moduleName = 'module'; $this->objectManagerMock->expects($this->once())->method('create') ->with( - 'Magento\Framework\Module\Updater\SetupInterface', + 'Magento\Framework\Setup\ModuleDataResourceInterface', [ 'resourceName' => $resourceName, 'moduleName' => $moduleName, @@ -38,7 +38,7 @@ public function testCreateUsesDefaultSetupModelClassIfSetupModelIsNotDeclaredFor /** * @expectedException \LogicException - * @expectedExceptionMessage \Not\Valid\Setup\Model is not a \Magento\Framework\Module\Updater\SetupInterface + * @expectedExceptionMessage \Not\Valid\Setup\Model must implement \Magento\Framework\Setup\ModuleDataResourceInterface */ public function testCreateThrowsExceptionIfSetupModelIsNotValid() { diff --git a/dev/tools/Magento/Tools/Migration/themes_view.php b/dev/tools/Magento/Tools/Migration/themes_view.php index a254bd38dc5c0..969bfd2f8ca5a 100644 --- a/dev/tools/Magento/Tools/Migration/themes_view.php +++ b/dev/tools/Magento/Tools/Migration/themes_view.php @@ -35,7 +35,7 @@ */ function updateFieldForTable($objectManager, $table, $col) { - /** @var $installer \Magento\Framework\Module\DataSetup */ + /** @var $installer \Magento\Framework\Setup\ModuleDataResourceInterface */ $installer = $objectManager->create('Magento\Framework\Module\DataSetup'); $installer->startSetup(); diff --git a/lib/internal/Magento/Framework/Module/DataSetup.php b/lib/internal/Magento/Framework/Module/DataSetup.php index 3a09eed3c42c3..0cfe54febbf6a 100644 --- a/lib/internal/Magento/Framework/Module/DataSetup.php +++ b/lib/internal/Magento/Framework/Module/DataSetup.php @@ -8,8 +8,9 @@ namespace Magento\Framework\Module; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Setup\ModuleDataResourceInterface; -class DataSetup extends \Magento\Framework\Module\Setup implements \Magento\Framework\Module\Updater\SetupInterface +class DataSetup extends \Magento\Framework\Module\Setup implements ModuleDataResourceInterface { /** * Setup resource name @@ -87,7 +88,7 @@ public function __construct( \Magento\Framework\Module\Setup\Context $context, $resourceName, $moduleName, - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { parent::__construct($context->getResourceModel(), $connectionName); $this->_eventManager = $context->getEventManager(); diff --git a/lib/internal/Magento/Framework/Module/DbVersionInfo.php b/lib/internal/Magento/Framework/Module/DbVersionInfo.php index adcaa81adbac3..d5897e7aee998 100644 --- a/lib/internal/Magento/Framework/Module/DbVersionInfo.php +++ b/lib/internal/Magento/Framework/Module/DbVersionInfo.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\Module; -use Magento\Framework\Module\Updater\SetupInterface; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Class DbVersionInfo @@ -158,6 +158,6 @@ private function isModuleVersionEqual($moduleName, $version) $configVer = $module['schema_version']; return ($version !== false - && version_compare($configVer, $version) === SetupInterface::VERSION_COMPARE_EQUAL); + && version_compare($configVer, $version) === ModuleDataResourceInterface::VERSION_COMPARE_EQUAL); } } diff --git a/lib/internal/Magento/Framework/Module/Manager.php b/lib/internal/Magento/Framework/Module/Manager.php index db61639cfd8bc..5152780b62f83 100644 --- a/lib/internal/Magento/Framework/Module/Manager.php +++ b/lib/internal/Magento/Framework/Module/Manager.php @@ -9,9 +9,6 @@ */ namespace Magento\Framework\Module; -use Magento\Framework\Module\Plugin\DbStatusValidator; -use Magento\Framework\Module\Updater\SetupInterface; - class Manager { /** diff --git a/lib/internal/Magento/Framework/Module/Setup.php b/lib/internal/Magento/Framework/Module/Setup.php index 07c0e19962f3a..6b9d7ba36dcb5 100644 --- a/lib/internal/Magento/Framework/Module/Setup.php +++ b/lib/internal/Magento/Framework/Module/Setup.php @@ -7,7 +7,10 @@ */ namespace Magento\Framework\Module; -class Setup +use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ResourceInterface; + +class Setup implements ResourceInterface { /** * Setup Connection @@ -43,7 +46,7 @@ class Setup */ public function __construct( \Magento\Framework\App\Resource $resource, - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { $this->_resourceModel = $resource; $this->_connectionName = $connectionName; diff --git a/lib/internal/Magento/Framework/Module/Setup/Migration.php b/lib/internal/Magento/Framework/Module/Setup/Migration.php index e612112b139cf..796c686e47353 100644 --- a/lib/internal/Magento/Framework/Module/Setup/Migration.php +++ b/lib/internal/Magento/Framework/Module/Setup/Migration.php @@ -6,6 +6,7 @@ namespace Magento\Framework\Module\Setup; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Resource setup model with methods needed for migration process between Magento versions @@ -138,7 +139,7 @@ public function __construct( $moduleName, \Magento\Framework\Module\Setup\MigrationData $migrationData, $confPathToMapFile, - $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION, + $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION, $compositeModules = [] ) { $this->_directory = $context->getFilesystem()->getDirectoryRead(DirectoryList::ROOT); diff --git a/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php b/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php index 80543e1d1f245..f959cec251ef5 100644 --- a/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php +++ b/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php @@ -8,10 +8,11 @@ namespace Magento\Framework\Module\Updater; use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Setup\ModuleDataResourceInterface; class SetupFactory { - const INSTANCE_TYPE = 'Magento\Framework\Module\Updater\SetupInterface'; + const INSTANCE_TYPE = 'Magento\Framework\Setup\ModuleDataResourceInterface'; /** * @var ObjectManagerInterface @@ -36,17 +37,17 @@ public function __construct(ObjectManagerInterface $objectManager, array $resour /** * @param string $resourceName * @param string $moduleName - * @return SetupInterface + * @return ModuleDataResourceInterface * @throws \LogicException */ public function create($resourceName, $moduleName) { $className = isset( $this->_resourceTypes[$resourceName] - ) ? $this->_resourceTypes[$resourceName] : 'Magento\Framework\Module\Updater\SetupInterface'; + ) ? $this->_resourceTypes[$resourceName] : self::INSTANCE_TYPE; if (false == is_subclass_of($className, self::INSTANCE_TYPE) && $className !== self::INSTANCE_TYPE) { - throw new \LogicException($className . ' is not a \Magento\Framework\Module\Updater\SetupInterface'); + throw new \LogicException($className . ' must implement \\' . self::INSTANCE_TYPE); } return $this->_objectManager->create( diff --git a/lib/internal/Magento/Framework/Module/Updater/SetupInterface.php b/lib/internal/Magento/Framework/Module/Updater/SetupInterface.php deleted file mode 100644 index c8158327ab352..0000000000000 --- a/lib/internal/Magento/Framework/Module/Updater/SetupInterface.php +++ /dev/null @@ -1,46 +0,0 @@ -logger = $log; From 33d4f7b37c4d34893dc156088013f2c03d06f904 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 10 Feb 2015 13:01:47 -0600 Subject: [PATCH 004/106] MAGETWO-33887: Create SPI interfaces and context class - added unit test - updated PHPDoc for introduced/modified interfaces --- .../Magento/Setup/Model/ModuleContextTest.php | 16 ++++++++++++++++ .../Setup/ModuleDataResourceInterface.php | 3 +++ .../Framework/Setup/ResourceInterface.php | 2 +- .../Framework/Setup/SchemaResourceInterface.php | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 dev/tests/unit/testsuite/Magento/Setup/Model/ModuleContextTest.php diff --git a/dev/tests/unit/testsuite/Magento/Setup/Model/ModuleContextTest.php b/dev/tests/unit/testsuite/Magento/Setup/Model/ModuleContextTest.php new file mode 100644 index 0000000000000..1a1a3cdf71cde --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Setup/Model/ModuleContextTest.php @@ -0,0 +1,16 @@ +assertSame($version, $object->getVersion()); + } +} diff --git a/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php b/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php index 7ba42b03f2454..907ba4d1d11e6 100644 --- a/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php +++ b/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\Setup; +/** + * DB data resource interface for a module + */ interface ModuleDataResourceInterface extends ResourceInterface { const DEFAULT_SETUP_CONNECTION = 'core_setup'; diff --git a/lib/internal/Magento/Framework/Setup/ResourceInterface.php b/lib/internal/Magento/Framework/Setup/ResourceInterface.php index 694604f3c62c8..e235c7ebc55ec 100644 --- a/lib/internal/Magento/Framework/Setup/ResourceInterface.php +++ b/lib/internal/Magento/Framework/Setup/ResourceInterface.php @@ -6,7 +6,7 @@ namespace Magento\Framework\Setup; /** - * DB schema resource interface for a module + * DB resource interface */ interface ResourceInterface { diff --git a/lib/internal/Magento/Framework/Setup/SchemaResourceInterface.php b/lib/internal/Magento/Framework/Setup/SchemaResourceInterface.php index d6dcb6ff46e4c..b2085e8f084d4 100644 --- a/lib/internal/Magento/Framework/Setup/SchemaResourceInterface.php +++ b/lib/internal/Magento/Framework/Setup/SchemaResourceInterface.php @@ -6,7 +6,7 @@ namespace Magento\Framework\Setup; /** - * DB schema resource interface for a module + * DB schema resource interface */ interface SchemaResourceInterface extends ResourceInterface { From 679e8977adab051b77ae391f47c603a21fb92326 Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Tue, 10 Feb 2015 15:12:15 -0600 Subject: [PATCH 005/106] MAGETWO-33884: Changes to database and module.xml - renamed schema_version to setup_version in module XML, CE only - changed core_resource table to have module names instead of resource - renamed column in core_resource from version to schema_version --- .../Magento/AdminNotification/etc/module.xml | 2 +- app/code/Magento/Authorization/etc/module.xml | 2 +- app/code/Magento/Backend/etc/module.xml | 2 +- app/code/Magento/Backup/etc/module.xml | 2 +- app/code/Magento/Bundle/etc/module.xml | 2 +- app/code/Magento/Captcha/etc/module.xml | 2 +- app/code/Magento/Catalog/etc/module.xml | 2 +- .../Magento/CatalogImportExport/etc/module.xml | 2 +- .../Magento/CatalogInventory/etc/module.xml | 2 +- app/code/Magento/CatalogRule/etc/module.xml | 2 +- app/code/Magento/CatalogSearch/etc/module.xml | 2 +- .../Magento/CatalogUrlRewrite/etc/module.xml | 2 +- app/code/Magento/CatalogWidget/etc/module.xml | 2 +- app/code/Magento/Centinel/etc/module.xml | 2 +- app/code/Magento/Checkout/etc/module.xml | 2 +- .../Magento/CheckoutAgreements/etc/module.xml | 2 +- app/code/Magento/Cms/etc/module.xml | 2 +- app/code/Magento/CmsUrlRewrite/etc/module.xml | 2 +- .../ConfigurableImportExport/etc/module.xml | 2 +- .../Magento/ConfigurableProduct/etc/module.xml | 2 +- app/code/Magento/Contact/etc/module.xml | 2 +- app/code/Magento/Cookie/etc/module.xml | 2 +- app/code/Magento/Core/etc/module.xml | 2 +- .../Core/sql/core_setup/install-2.0.0.php | 2 +- app/code/Magento/Cron/etc/module.xml | 2 +- app/code/Magento/CurrencySymbol/etc/module.xml | 2 +- app/code/Magento/Customer/etc/module.xml | 2 +- .../CustomerImportExport/etc/module.xml | 2 +- app/code/Magento/DesignEditor/etc/module.xml | 2 +- app/code/Magento/Developer/etc/module.xml | 2 +- app/code/Magento/Dhl/etc/module.xml | 2 +- app/code/Magento/Directory/etc/module.xml | 2 +- app/code/Magento/Downloadable/etc/module.xml | 2 +- app/code/Magento/Eav/etc/module.xml | 2 +- app/code/Magento/Email/etc/module.xml | 2 +- app/code/Magento/Fedex/etc/module.xml | 2 +- app/code/Magento/GiftMessage/etc/module.xml | 2 +- app/code/Magento/GoogleAdwords/etc/module.xml | 2 +- .../Magento/GoogleAnalytics/etc/module.xml | 2 +- .../Magento/GoogleOptimizer/etc/module.xml | 2 +- app/code/Magento/GoogleShopping/etc/module.xml | 2 +- .../Magento/GroupedImportExport/etc/module.xml | 2 +- app/code/Magento/GroupedProduct/etc/module.xml | 2 +- app/code/Magento/ImportExport/etc/module.xml | 2 +- app/code/Magento/Indexer/etc/module.xml | 2 +- app/code/Magento/Integration/etc/module.xml | 2 +- .../Magento/LayeredNavigation/etc/module.xml | 2 +- app/code/Magento/Log/etc/module.xml | 2 +- app/code/Magento/Msrp/etc/module.xml | 2 +- app/code/Magento/Multishipping/etc/module.xml | 2 +- app/code/Magento/Newsletter/etc/module.xml | 2 +- .../Magento/OfflinePayments/etc/module.xml | 2 +- .../Magento/OfflineShipping/etc/module.xml | 2 +- app/code/Magento/PageCache/etc/module.xml | 2 +- app/code/Magento/Payment/etc/module.xml | 2 +- app/code/Magento/Persistent/etc/module.xml | 2 +- app/code/Magento/ProductAlert/etc/module.xml | 2 +- app/code/Magento/Quote/etc/module.xml | 2 +- app/code/Magento/Reports/etc/module.xml | 2 +- app/code/Magento/RequireJs/etc/module.xml | 2 +- app/code/Magento/Review/etc/module.xml | 2 +- app/code/Magento/Rss/etc/module.xml | 2 +- app/code/Magento/Rule/etc/module.xml | 2 +- app/code/Magento/Sales/etc/module.xml | 2 +- app/code/Magento/SalesRule/etc/module.xml | 2 +- app/code/Magento/Search/etc/module.xml | 2 +- app/code/Magento/Sendfriend/etc/module.xml | 2 +- app/code/Magento/Shipping/etc/module.xml | 2 +- app/code/Magento/Sitemap/etc/module.xml | 2 +- app/code/Magento/Store/etc/module.xml | 2 +- app/code/Magento/Tax/etc/module.xml | 2 +- .../Magento/TaxImportExport/etc/module.xml | 2 +- app/code/Magento/Theme/etc/module.xml | 2 +- app/code/Magento/Translation/etc/module.xml | 2 +- app/code/Magento/Ui/etc/module.xml | 2 +- app/code/Magento/Ups/etc/module.xml | 2 +- app/code/Magento/UrlRewrite/etc/module.xml | 2 +- app/code/Magento/User/etc/module.xml | 2 +- app/code/Magento/Usps/etc/module.xml | 2 +- app/code/Magento/Webapi/etc/module.xml | 2 +- app/code/Magento/Weee/etc/module.xml | 2 +- app/code/Magento/Widget/etc/module.xml | 2 +- app/code/Magento/Wishlist/etc/module.xml | 2 +- .../_files/Magento/TestModule1/etc/module.xml | 2 +- .../_files/Magento/TestModule2/etc/module.xml | 2 +- .../_files/Magento/TestModule3/etc/module.xml | 2 +- .../_files/Magento/TestModule4/etc/module.xml | 2 +- .../_files/Magento/TestModule5/etc/module.xml | 2 +- .../Magento/TestModuleMSC/etc/module.xml | 2 +- .../Magento/Core/_files/etc/module.xml | 2 +- .../Magento/Framework/Module/ModuleXMLTest.php | 2 +- .../Framework/Module/DbVersionInfoTest.php | 8 ++++---- .../Module/Declaration/Converter/DomTest.php | 2 +- .../_files/converted_valid_module.php | 4 ++-- .../Converter/_files/valid_module.xml | 4 ++-- .../Magento/Framework/Module/ManagerTest.php | 4 ++-- .../Magento/Setup/Module/SetupModuleTest.php | 2 +- .../Magento/Framework/Module/DataSetup.php | 18 +++++++++++++----- .../Magento/Framework/Module/DbVersionInfo.php | 14 +++++++------- .../Module/Declaration/Converter/Dom.php | 4 ++-- .../Magento/Framework/Module/Resource.php | 4 ++-- .../Magento/Framework/Module/etc/module.xsd | 4 ++-- setup/src/Magento/Setup/Module/SetupModule.php | 17 ++++++++++++----- 103 files changed, 141 insertions(+), 126 deletions(-) diff --git a/app/code/Magento/AdminNotification/etc/module.xml b/app/code/Magento/AdminNotification/etc/module.xml index fb34ccfe929fc..cfc791e9072d9 100644 --- a/app/code/Magento/AdminNotification/etc/module.xml +++ b/app/code/Magento/AdminNotification/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Authorization/etc/module.xml b/app/code/Magento/Authorization/etc/module.xml index 36f6dfc1c490a..6c30cdc5c72ec 100644 --- a/app/code/Magento/Authorization/etc/module.xml +++ b/app/code/Magento/Authorization/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index 03c374acdefc9..91d3eee738c3f 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 315546d99b5af..c94b544ae405f 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/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml index 7de97d8dbcf26..5f435d51c45dd 100644 --- a/app/code/Magento/Bundle/etc/module.xml +++ b/app/code/Magento/Bundle/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Captcha/etc/module.xml b/app/code/Magento/Captcha/etc/module.xml index a05bfbde75f3b..c12f90813ab7a 100644 --- a/app/code/Magento/Captcha/etc/module.xml +++ b/app/code/Magento/Captcha/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index 7670d169b3aff..ccb21b6aadb8e 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/CatalogImportExport/etc/module.xml b/app/code/Magento/CatalogImportExport/etc/module.xml index e0957b7d6b490..b54786a0521ce 100644 --- a/app/code/Magento/CatalogImportExport/etc/module.xml +++ b/app/code/Magento/CatalogImportExport/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/CatalogInventory/etc/module.xml b/app/code/Magento/CatalogInventory/etc/module.xml index 0bafe05d784ec..e13f240678f49 100644 --- a/app/code/Magento/CatalogInventory/etc/module.xml +++ b/app/code/Magento/CatalogInventory/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/CatalogRule/etc/module.xml b/app/code/Magento/CatalogRule/etc/module.xml index 4b691f43d0dac..ecd6a4eac2cda 100644 --- a/app/code/Magento/CatalogRule/etc/module.xml +++ b/app/code/Magento/CatalogRule/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/CatalogSearch/etc/module.xml b/app/code/Magento/CatalogSearch/etc/module.xml index f96fbda235546..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/CatalogUrlRewrite/etc/module.xml b/app/code/Magento/CatalogUrlRewrite/etc/module.xml index 455b91f7a3715..9b9ebb4f15bc6 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/module.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/CatalogWidget/etc/module.xml b/app/code/Magento/CatalogWidget/etc/module.xml index c85c01ac5a645..b49ad17357a69 100644 --- a/app/code/Magento/CatalogWidget/etc/module.xml +++ b/app/code/Magento/CatalogWidget/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Centinel/etc/module.xml b/app/code/Magento/Centinel/etc/module.xml index 92898f6fe044d..1b9fa14e9f40d 100644 --- a/app/code/Magento/Centinel/etc/module.xml +++ b/app/code/Magento/Centinel/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Checkout/etc/module.xml b/app/code/Magento/Checkout/etc/module.xml index 2bac81043169f..e73a054bd0b23 100644 --- a/app/code/Magento/Checkout/etc/module.xml +++ b/app/code/Magento/Checkout/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/CheckoutAgreements/etc/module.xml b/app/code/Magento/CheckoutAgreements/etc/module.xml index 877aa58c8256b..36bad32ebf304 100644 --- a/app/code/Magento/CheckoutAgreements/etc/module.xml +++ b/app/code/Magento/CheckoutAgreements/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Cms/etc/module.xml b/app/code/Magento/Cms/etc/module.xml index 62cd4e494a8b0..e083de84b5d1c 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/CmsUrlRewrite/etc/module.xml b/app/code/Magento/CmsUrlRewrite/etc/module.xml index 0808406f60d98..c209306fd7e41 100644 --- a/app/code/Magento/CmsUrlRewrite/etc/module.xml +++ b/app/code/Magento/CmsUrlRewrite/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/ConfigurableImportExport/etc/module.xml b/app/code/Magento/ConfigurableImportExport/etc/module.xml index 1336187979ed6..a44fb38ec5d10 100644 --- a/app/code/Magento/ConfigurableImportExport/etc/module.xml +++ b/app/code/Magento/ConfigurableImportExport/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/ConfigurableProduct/etc/module.xml b/app/code/Magento/ConfigurableProduct/etc/module.xml index ed7bf55ba0a5a..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/Contact/etc/module.xml b/app/code/Magento/Contact/etc/module.xml index 21b6970b419d8..9962113cf348f 100644 --- a/app/code/Magento/Contact/etc/module.xml +++ b/app/code/Magento/Contact/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Cookie/etc/module.xml b/app/code/Magento/Cookie/etc/module.xml index 6060f3a17283b..462bc56f2ec7b 100644 --- a/app/code/Magento/Cookie/etc/module.xml +++ b/app/code/Magento/Cookie/etc/module.xml @@ -6,5 +6,5 @@ */ --> - + diff --git a/app/code/Magento/Core/etc/module.xml b/app/code/Magento/Core/etc/module.xml index 52b8b8f685f64..665171f5a6ad8 100644 --- a/app/code/Magento/Core/etc/module.xml +++ b/app/code/Magento/Core/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/Core/sql/core_setup/install-2.0.0.php b/app/code/Magento/Core/sql/core_setup/install-2.0.0.php index 2c5e75d5b54b3..517f2901b50cd 100644 --- a/app/code/Magento/Core/sql/core_setup/install-2.0.0.php +++ b/app/code/Magento/Core/sql/core_setup/install-2.0.0.php @@ -24,7 +24,7 @@ ['nullable' => false, 'primary' => true], 'Resource Code' )->addColumn( - 'version', + 'setup_version', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 50, [], diff --git a/app/code/Magento/Cron/etc/module.xml b/app/code/Magento/Cron/etc/module.xml index d88d54d09f131..554d1362ba744 100644 --- a/app/code/Magento/Cron/etc/module.xml +++ b/app/code/Magento/Cron/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/CurrencySymbol/etc/module.xml b/app/code/Magento/CurrencySymbol/etc/module.xml index 0d61b24af29ca..30fab952ed73f 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/etc/module.xml b/app/code/Magento/Customer/etc/module.xml index 93233481ccf7f..33f923e05015b 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/CustomerImportExport/etc/module.xml b/app/code/Magento/CustomerImportExport/etc/module.xml index 5d1183b7d69b2..c4fc8e8a709e7 100644 --- a/app/code/Magento/CustomerImportExport/etc/module.xml +++ b/app/code/Magento/CustomerImportExport/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/DesignEditor/etc/module.xml b/app/code/Magento/DesignEditor/etc/module.xml index c4926198e6c6e..59defb0ad0fe6 100644 --- a/app/code/Magento/DesignEditor/etc/module.xml +++ b/app/code/Magento/DesignEditor/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Developer/etc/module.xml b/app/code/Magento/Developer/etc/module.xml index 3b154ec40b46f..2bc215c15c7cf 100644 --- a/app/code/Magento/Developer/etc/module.xml +++ b/app/code/Magento/Developer/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/Dhl/etc/module.xml b/app/code/Magento/Dhl/etc/module.xml index 60487cf4df712..1bbb4b455fe93 100644 --- a/app/code/Magento/Dhl/etc/module.xml +++ b/app/code/Magento/Dhl/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/Directory/etc/module.xml b/app/code/Magento/Directory/etc/module.xml index 9de6652536fd5..c2f5119fbd915 100644 --- a/app/code/Magento/Directory/etc/module.xml +++ b/app/code/Magento/Directory/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Downloadable/etc/module.xml b/app/code/Magento/Downloadable/etc/module.xml index 71d5a61d3134b..7441c7e447d44 100644 --- a/app/code/Magento/Downloadable/etc/module.xml +++ b/app/code/Magento/Downloadable/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Eav/etc/module.xml b/app/code/Magento/Eav/etc/module.xml index e0da2b4513f99..156e78c1bdd64 100644 --- a/app/code/Magento/Eav/etc/module.xml +++ b/app/code/Magento/Eav/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Email/etc/module.xml b/app/code/Magento/Email/etc/module.xml index 8e5718792f5c3..30252dd178b9e 100644 --- a/app/code/Magento/Email/etc/module.xml +++ b/app/code/Magento/Email/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Fedex/etc/module.xml b/app/code/Magento/Fedex/etc/module.xml index aada69380881c..d710c059676a4 100644 --- a/app/code/Magento/Fedex/etc/module.xml +++ b/app/code/Magento/Fedex/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/GiftMessage/etc/module.xml b/app/code/Magento/GiftMessage/etc/module.xml index 3e80542291b60..a40233763e309 100644 --- a/app/code/Magento/GiftMessage/etc/module.xml +++ b/app/code/Magento/GiftMessage/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/GoogleAdwords/etc/module.xml b/app/code/Magento/GoogleAdwords/etc/module.xml index f0d813836fb55..a64f74385f093 100644 --- a/app/code/Magento/GoogleAdwords/etc/module.xml +++ b/app/code/Magento/GoogleAdwords/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/GoogleAnalytics/etc/module.xml b/app/code/Magento/GoogleAnalytics/etc/module.xml index 5b4d08c4c3c53..0012f962d97a8 100644 --- a/app/code/Magento/GoogleAnalytics/etc/module.xml +++ b/app/code/Magento/GoogleAnalytics/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/GoogleOptimizer/etc/module.xml b/app/code/Magento/GoogleOptimizer/etc/module.xml index f553d7a07c7a1..869688b1a966d 100644 --- a/app/code/Magento/GoogleOptimizer/etc/module.xml +++ b/app/code/Magento/GoogleOptimizer/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/GoogleShopping/etc/module.xml b/app/code/Magento/GoogleShopping/etc/module.xml index a4152d20c8bb2..a14c6a7c89433 100644 --- a/app/code/Magento/GoogleShopping/etc/module.xml +++ b/app/code/Magento/GoogleShopping/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/GroupedImportExport/etc/module.xml b/app/code/Magento/GroupedImportExport/etc/module.xml index f4fd9339ab14c..3a478e2fbf59c 100644 --- a/app/code/Magento/GroupedImportExport/etc/module.xml +++ b/app/code/Magento/GroupedImportExport/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/GroupedProduct/etc/module.xml b/app/code/Magento/GroupedProduct/etc/module.xml index 8f84d994e5ae9..a658f20e3758e 100644 --- a/app/code/Magento/GroupedProduct/etc/module.xml +++ b/app/code/Magento/GroupedProduct/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/ImportExport/etc/module.xml b/app/code/Magento/ImportExport/etc/module.xml index b70c34572dbb8..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/etc/module.xml b/app/code/Magento/Indexer/etc/module.xml index 9bf3d5a5302b5..4105ec2268543 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/Integration/etc/module.xml b/app/code/Magento/Integration/etc/module.xml index 6723cfcff2370..eec3177c1fcfe 100644 --- a/app/code/Magento/Integration/etc/module.xml +++ b/app/code/Magento/Integration/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/LayeredNavigation/etc/module.xml b/app/code/Magento/LayeredNavigation/etc/module.xml index 1df220d7e9e0b..a2f79c4e234aa 100644 --- a/app/code/Magento/LayeredNavigation/etc/module.xml +++ b/app/code/Magento/LayeredNavigation/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/Log/etc/module.xml b/app/code/Magento/Log/etc/module.xml index 6b905f3f2e358..bbd666acf383c 100644 --- a/app/code/Magento/Log/etc/module.xml +++ b/app/code/Magento/Log/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Msrp/etc/module.xml b/app/code/Magento/Msrp/etc/module.xml index 6685236590dec..ad6f4be3319df 100644 --- a/app/code/Magento/Msrp/etc/module.xml +++ b/app/code/Magento/Msrp/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 27d308c3eba56..e094dae155cd0 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/Newsletter/etc/module.xml b/app/code/Magento/Newsletter/etc/module.xml index 2dffece465adc..13a4697cc7900 100644 --- a/app/code/Magento/Newsletter/etc/module.xml +++ b/app/code/Magento/Newsletter/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/OfflinePayments/etc/module.xml b/app/code/Magento/OfflinePayments/etc/module.xml index 622cbe778cfb6..e458b01209535 100644 --- a/app/code/Magento/OfflinePayments/etc/module.xml +++ b/app/code/Magento/OfflinePayments/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/OfflineShipping/etc/module.xml b/app/code/Magento/OfflineShipping/etc/module.xml index fa87ce91d4ecb..f26ec0e72e7c2 100644 --- a/app/code/Magento/OfflineShipping/etc/module.xml +++ b/app/code/Magento/OfflineShipping/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 a6f9421bc9311..6ed0d8eb69e65 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/Payment/etc/module.xml b/app/code/Magento/Payment/etc/module.xml index ec36fb62f49ff..af49342484e53 100644 --- a/app/code/Magento/Payment/etc/module.xml +++ b/app/code/Magento/Payment/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Persistent/etc/module.xml b/app/code/Magento/Persistent/etc/module.xml index 16858974f37d3..1d36077f77a44 100644 --- a/app/code/Magento/Persistent/etc/module.xml +++ b/app/code/Magento/Persistent/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/ProductAlert/etc/module.xml b/app/code/Magento/ProductAlert/etc/module.xml index 1d96bb6318406..ff314d32a05f4 100644 --- a/app/code/Magento/ProductAlert/etc/module.xml +++ b/app/code/Magento/ProductAlert/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Quote/etc/module.xml b/app/code/Magento/Quote/etc/module.xml index a8d932efe8d00..81d8176a9ba36 100644 --- a/app/code/Magento/Quote/etc/module.xml +++ b/app/code/Magento/Quote/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/Reports/etc/module.xml b/app/code/Magento/Reports/etc/module.xml index 4511725cecb30..1d5b4daa52975 100644 --- a/app/code/Magento/Reports/etc/module.xml +++ b/app/code/Magento/Reports/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 79bcca0a4512f..05927da66756a 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/Review/etc/module.xml b/app/code/Magento/Review/etc/module.xml index 66bf7b00f3b74..ee43b6223153e 100644 --- a/app/code/Magento/Review/etc/module.xml +++ b/app/code/Magento/Review/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Rss/etc/module.xml b/app/code/Magento/Rss/etc/module.xml index a0a73f1778157..4122071f8b9d3 100644 --- a/app/code/Magento/Rss/etc/module.xml +++ b/app/code/Magento/Rss/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/Rule/etc/module.xml b/app/code/Magento/Rule/etc/module.xml index b9baccaca1df3..b1ee185e3ec29 100644 --- a/app/code/Magento/Rule/etc/module.xml +++ b/app/code/Magento/Rule/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml index 164a3e416a04d..54f554e7e038c 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/SalesRule/etc/module.xml b/app/code/Magento/SalesRule/etc/module.xml index 931a370eeedd1..3d3f8c47b2b26 100644 --- a/app/code/Magento/SalesRule/etc/module.xml +++ b/app/code/Magento/SalesRule/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Search/etc/module.xml b/app/code/Magento/Search/etc/module.xml index 53176dd661f55..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/Sendfriend/etc/module.xml b/app/code/Magento/Sendfriend/etc/module.xml index de086ae51a053..eedc4988739d7 100644 --- a/app/code/Magento/Sendfriend/etc/module.xml +++ b/app/code/Magento/Sendfriend/etc/module.xml @@ -7,7 +7,7 @@ --> - + diff --git a/app/code/Magento/Shipping/etc/module.xml b/app/code/Magento/Shipping/etc/module.xml index 866bf77d0bb5e..a296db3e65e56 100644 --- a/app/code/Magento/Shipping/etc/module.xml +++ b/app/code/Magento/Shipping/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Sitemap/etc/module.xml b/app/code/Magento/Sitemap/etc/module.xml index a2713841ee005..c43776ead682c 100644 --- a/app/code/Magento/Sitemap/etc/module.xml +++ b/app/code/Magento/Sitemap/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Store/etc/module.xml b/app/code/Magento/Store/etc/module.xml index 10d5da1231dc1..e01760c2873fb 100644 --- a/app/code/Magento/Store/etc/module.xml +++ b/app/code/Magento/Store/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Tax/etc/module.xml b/app/code/Magento/Tax/etc/module.xml index 11ccd05783729..865aedbf33777 100644 --- a/app/code/Magento/Tax/etc/module.xml +++ b/app/code/Magento/Tax/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/TaxImportExport/etc/module.xml b/app/code/Magento/TaxImportExport/etc/module.xml index bc2f41ee16c8b..64d6d6544460d 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/etc/module.xml b/app/code/Magento/Theme/etc/module.xml index 6be8fcb4b0112..30b3857eac7e9 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/Translation/etc/module.xml b/app/code/Magento/Translation/etc/module.xml index a33f370026e70..0b973ed3ef7be 100644 --- a/app/code/Magento/Translation/etc/module.xml +++ b/app/code/Magento/Translation/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Ui/etc/module.xml b/app/code/Magento/Ui/etc/module.xml index f05bbc1bba8df..cd21706e0b7d2 100644 --- a/app/code/Magento/Ui/etc/module.xml +++ b/app/code/Magento/Ui/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Ups/etc/module.xml b/app/code/Magento/Ups/etc/module.xml index eb0dfd3720470..d823746a1d931 100644 --- a/app/code/Magento/Ups/etc/module.xml +++ b/app/code/Magento/Ups/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/UrlRewrite/etc/module.xml b/app/code/Magento/UrlRewrite/etc/module.xml index 6b388be4fff2b..5e0c8f0b5d078 100644 --- a/app/code/Magento/UrlRewrite/etc/module.xml +++ b/app/code/Magento/UrlRewrite/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/User/etc/module.xml b/app/code/Magento/User/etc/module.xml index 973555fc8133a..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/Usps/etc/module.xml b/app/code/Magento/Usps/etc/module.xml index 2d7f3df13589f..8cd9e5a58b74e 100644 --- a/app/code/Magento/Usps/etc/module.xml +++ b/app/code/Magento/Usps/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/Webapi/etc/module.xml b/app/code/Magento/Webapi/etc/module.xml index 1062bff16eb69..6d384c3072dee 100644 --- a/app/code/Magento/Webapi/etc/module.xml +++ b/app/code/Magento/Webapi/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 ab974bb09e637..19658377fc4a7 100644 --- a/app/code/Magento/Weee/etc/module.xml +++ b/app/code/Magento/Weee/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Widget/etc/module.xml b/app/code/Magento/Widget/etc/module.xml index cb4c2aa73dacd..602d520a715c1 100644 --- a/app/code/Magento/Widget/etc/module.xml +++ b/app/code/Magento/Widget/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Wishlist/etc/module.xml b/app/code/Magento/Wishlist/etc/module.xml index 9be0c649ede47..0edf7b7b8d207 100644 --- a/app/code/Magento/Wishlist/etc/module.xml +++ b/app/code/Magento/Wishlist/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/etc/module.xml b/dev/tests/api-functional/_files/Magento/TestModule1/etc/module.xml index ce968d8c89b50..f7337b30e486f 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule1/etc/module.xml +++ b/dev/tests/api-functional/_files/Magento/TestModule1/etc/module.xml @@ -6,5 +6,5 @@ */ --> - + diff --git a/dev/tests/api-functional/_files/Magento/TestModule2/etc/module.xml b/dev/tests/api-functional/_files/Magento/TestModule2/etc/module.xml index 0815f9a00ec63..fb8a06e73af89 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule2/etc/module.xml +++ b/dev/tests/api-functional/_files/Magento/TestModule2/etc/module.xml @@ -6,5 +6,5 @@ */ --> - + diff --git a/dev/tests/api-functional/_files/Magento/TestModule3/etc/module.xml b/dev/tests/api-functional/_files/Magento/TestModule3/etc/module.xml index 618586550f038..b38cbe026846a 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule3/etc/module.xml +++ b/dev/tests/api-functional/_files/Magento/TestModule3/etc/module.xml @@ -6,5 +6,5 @@ */ --> - + diff --git a/dev/tests/api-functional/_files/Magento/TestModule4/etc/module.xml b/dev/tests/api-functional/_files/Magento/TestModule4/etc/module.xml index e08679b48fd75..c5f567f999afe 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule4/etc/module.xml +++ b/dev/tests/api-functional/_files/Magento/TestModule4/etc/module.xml @@ -6,5 +6,5 @@ */ --> - + diff --git a/dev/tests/api-functional/_files/Magento/TestModule5/etc/module.xml b/dev/tests/api-functional/_files/Magento/TestModule5/etc/module.xml index 99b6164780bfa..c1acfbb9925e5 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule5/etc/module.xml +++ b/dev/tests/api-functional/_files/Magento/TestModule5/etc/module.xml @@ -6,5 +6,5 @@ */ --> - + diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/etc/module.xml b/dev/tests/api-functional/_files/Magento/TestModuleMSC/etc/module.xml index f7f88b99a369f..138ae61a91b28 100644 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/etc/module.xml +++ b/dev/tests/api-functional/_files/Magento/TestModuleMSC/etc/module.xml @@ -6,5 +6,5 @@ */ --> - + diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/etc/module.xml b/dev/tests/integration/testsuite/Magento/Core/_files/etc/module.xml index 996b20467d263..746181c42b2ba 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/etc/module.xml +++ b/dev/tests/integration/testsuite/Magento/Core/_files/etc/module.xml @@ -6,5 +6,5 @@ */ --> - + diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/Module/ModuleXMLTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/Module/ModuleXMLTest.php index 7fd4dbe3ccc09..a37a782d12749 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/Module/ModuleXMLTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/Module/ModuleXMLTest.php @@ -20,7 +20,7 @@ public function testModuleXml($file) $xml = simplexml_load_file($file); $this->assertEmpty( $xml->xpath('/config/module/@version'), - 'The "version" attribute is obsolete. Use "schema_version" instead.' + 'The "version" attribute is obsolete. Use "setup_version" instead.' ); $this->assertEmpty( $xml->xpath('/config/module/@active'), diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php index d605a28341e6e..83add320474cf 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php @@ -34,8 +34,8 @@ protected function setUp() $this->moduleList->expects($this->any()) ->method('getOne') ->will($this->returnValueMap([ - ['Module_One', ['name' => 'Module_One', 'schema_version' => '1']], - ['Module_Two', ['name' => 'Module_Two', 'schema_version' => '2']], + ['Module_One', ['name' => 'Module_One', 'setup_version' => '1']], + ['Module_Two', ['name' => 'Module_Two', 'setup_version' => '2']], ['Module_No_Schema', []], ])); $this->moduleList->expects($this->any()) @@ -132,8 +132,8 @@ public function testGetDbVersionErrors() ->will($this->returnValue(2)); $this->resourceResolver->expects($this->any())->method('getResourceList')->will($this->returnValueMap([ - ['Module_One', ['resource_one']], - ['Module_Two', ['resource_two']], + ['Module_One', ['Module_One']], + ['Module_Two', ['Module_Two']], ])); $expectedErrors = [ diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/DomTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/DomTest.php index 2dfaa98de2268..f7006038ef96c 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/DomTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/DomTest.php @@ -43,7 +43,7 @@ public function testConvertWithInvalidDomDataProvider() return [ 'Module node without "name" attribute' => [''], 'Sequence module node without "name" attribute' => [ - '' . + '' . '', ], ]; diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/_files/converted_valid_module.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/_files/converted_valid_module.php index 72f9c2b518024..0541f609d81e3 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/_files/converted_valid_module.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/_files/converted_valid_module.php @@ -6,12 +6,12 @@ return [ 'Module_One' => [ 'name' => 'Module_One', - 'schema_version' => '1.0.0.0', + 'setup_version' => '1.0.0.0', 'sequence' => [], ], 'Module_Two' => [ 'name' => 'Module_Two', - 'schema_version' => '2.0.0.0', + 'setup_version' => '2.0.0.0', 'sequence' => ['Module_One'], ] ]; diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/_files/valid_module.xml b/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/_files/valid_module.xml index 19e98536b0850..da1d5ff6e2a19 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/_files/valid_module.xml +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Converter/_files/valid_module.xml @@ -7,9 +7,9 @@ --> - + - + diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/ManagerTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/ManagerTest.php index cb080463f1309..25ce990549850 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/ManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/ManagerTest.php @@ -35,8 +35,8 @@ protected function setUp() $this->_moduleList->expects($this->any()) ->method('getOne') ->will($this->returnValueMap([ - ['Module_One', ['name' => 'One_Module', 'schema_version' => '1']], - ['Module_Two', ['name' => 'Two_Module', 'schema_version' => '2']], + ['Module_One', ['name' => 'One_Module', 'setup_version' => '1']], + ['Module_Two', ['name' => 'Two_Module', 'setup_version' => '2']], ['Module_Three', ['name' => 'Two_Three']], ])); $this->_outputConfig = $this->getMockForAbstractClass('Magento\Framework\Module\Output\ConfigInterface'); diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/SetupModuleTest.php b/dev/tests/unit/testsuite/Magento/Setup/Module/SetupModuleTest.php index 75fabe08645a2..57379f400c499 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/SetupModuleTest.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Module/SetupModuleTest.php @@ -39,7 +39,7 @@ protected function setUp() ->expects($this->once()) ->method('getOne') ->with($this->moduleName) - ->will($this->returnValue(['name' => 'SampleModule', 'schema_version' => '2.0.0'])); + ->will($this->returnValue(['name' => 'SampleModule', 'setup_version' => '2.0.0'])); $this->resourceModelMock = $this->getMock('Magento\Framework\App\Resource', [], [], '', false); } diff --git a/lib/internal/Magento/Framework/Module/DataSetup.php b/lib/internal/Magento/Framework/Module/DataSetup.php index 0cfe54febbf6a..f6a97a6d0a944 100644 --- a/lib/internal/Magento/Framework/Module/DataSetup.php +++ b/lib/internal/Magento/Framework/Module/DataSetup.php @@ -18,6 +18,12 @@ class DataSetup extends \Magento\Framework\Module\Setup implements ModuleDataRes */ private $_resourceName; + /** + * Setup module name + * @var string + */ + protected $moduleName; + /** * Setup module configuration object * @@ -95,6 +101,8 @@ public function __construct( $this->_logger = $context->getLogger(); $this->_modulesReader = $context->getModulesReader(); $this->_resourceName = $resourceName; + $this->moduleName = $moduleName; + $this->_resource = $context->getResource(); $this->_migrationFactory = $context->getMigrationFactory(); $this->_moduleConfig = $context->getModuleList()->getOne($moduleName); @@ -109,8 +117,8 @@ public function __construct( */ public function applyDataUpdates() { - $dataVer = $this->_resource->getDataVersion($this->_resourceName); - $configVer = $this->_moduleConfig['schema_version']; + $dataVer = $this->_resource->getDataVersion($this->moduleName); + $configVer = $this->_moduleConfig['setup_version']; if ($dataVer !== false) { $status = version_compare($configVer, $dataVer); if ($status == self::VERSION_COMPARE_GREATER) { @@ -132,7 +140,7 @@ private function _installData($newVersion) { $oldVersion = $this->_modifyResourceDb(self::TYPE_DATA_INSTALL, '', $newVersion); $this->_modifyResourceDb(self::TYPE_DATA_UPGRADE, $oldVersion, $newVersion); - $this->_resource->setDataVersion($this->_resourceName, $newVersion); + $this->_resource->setDataVersion($this->moduleName, $newVersion); return $this; } @@ -147,7 +155,7 @@ private function _installData($newVersion) private function _upgradeData($oldVersion, $newVersion) { $this->_modifyResourceDb('data-upgrade', $oldVersion, $newVersion); - $this->_resource->setDataVersion($this->_resourceName, $newVersion); + $this->_resource->setDataVersion($this->moduleName, $newVersion); return $this; } @@ -224,7 +232,7 @@ private function _modifyResourceDb($actionType, $fromVersion, $toVersion) } if ($result) { - $this->_resource->setDataVersion($this->_resourceName, $file['toVersion']); + $this->_resource->setDataVersion($this->moduleName, $file['toVersion']); $this->_logger->debug($fileName); } else { $this->_logger->debug("Failed resource setup: {$fileName}"); diff --git a/lib/internal/Magento/Framework/Module/DbVersionInfo.php b/lib/internal/Magento/Framework/Module/DbVersionInfo.php index d5897e7aee998..59afafd18d20d 100644 --- a/lib/internal/Magento/Framework/Module/DbVersionInfo.php +++ b/lib/internal/Magento/Framework/Module/DbVersionInfo.php @@ -61,7 +61,7 @@ public function __construct( */ public function isSchemaUpToDate($moduleName, $resourceName) { - $dbVer = $this->moduleResource->getDbVersion($resourceName); + $dbVer = $this->moduleResource->getDbVersion($moduleName); return $this->isModuleVersionEqual($moduleName, $dbVer); } @@ -72,7 +72,7 @@ public function isSchemaUpToDate($moduleName, $resourceName) */ public function isDataUpToDate($moduleName, $resourceName) { - $dataVer = $this->moduleResource->getDataVersion($resourceName); + $dataVer = $this->moduleResource->getDataVersion($moduleName); return $this->isModuleVersionEqual($moduleName, $dataVer); } @@ -110,7 +110,7 @@ private function getSchemaInfo($moduleName, $resourceName) { $dbVer = $this->moduleResource->getDbVersion($resourceName); // version saved in DB $module = $this->moduleList->getOne($moduleName); - $configVer = $module['schema_version']; + $configVer = $module['setup_version']; $dbVer = $dbVer ?: 'none'; return [ self::KEY_CURRENT => $dbVer, @@ -131,7 +131,7 @@ private function getDataInfo($moduleName, $resourceName) { $dataVer = $this->moduleResource->getDataVersion($resourceName); $module = $this->moduleList->getOne($moduleName); - $configVer = $module['schema_version']; + $configVer = $module['setup_version']; $dataVer = $dataVer ?: 'none'; return [ self::KEY_CURRENT => $dataVer, @@ -152,10 +152,10 @@ private function getDataInfo($moduleName, $resourceName) private function isModuleVersionEqual($moduleName, $version) { $module = $this->moduleList->getOne($moduleName); - if (empty($module['schema_version'])) { - throw new \UnexpectedValueException("Schema version for module '$moduleName' is not specified"); + if (empty($module['setup_version'])) { + throw new \UnexpectedValueException("Setup version for module '$moduleName' is not specified"); } - $configVer = $module['schema_version']; + $configVer = $module['setup_version']; return ($version !== false && version_compare($configVer, $version) === ModuleDataResourceInterface::VERSION_COMPARE_EQUAL); diff --git a/lib/internal/Magento/Framework/Module/Declaration/Converter/Dom.php b/lib/internal/Magento/Framework/Module/Declaration/Converter/Dom.php index de874d54f1f51..12d86995f00d2 100644 --- a/lib/internal/Magento/Framework/Module/Declaration/Converter/Dom.php +++ b/lib/internal/Magento/Framework/Module/Declaration/Converter/Dom.php @@ -27,11 +27,11 @@ public function convert($source) } $moduleData['name'] = $nameNode->nodeValue; $name = $moduleData['name']; - $versionNode = $moduleAttributes->getNamedItem('schema_version'); + $versionNode = $moduleAttributes->getNamedItem('setup_version'); if (is_null($versionNode)) { throw new \Exception("Attribute 'schema_version' is missing for module '{$name}'."); } - $moduleData['schema_version'] = $versionNode->nodeValue; + $moduleData['setup_version'] = $versionNode->nodeValue; $moduleData['sequence'] = []; /** @var $childNode \DOMNode */ foreach ($moduleNode->childNodes as $childNode) { diff --git a/lib/internal/Magento/Framework/Module/Resource.php b/lib/internal/Magento/Framework/Module/Resource.php index f054cb1480ec3..396c46dbdc237 100644 --- a/lib/internal/Magento/Framework/Module/Resource.php +++ b/lib/internal/Magento/Framework/Module/Resource.php @@ -60,7 +60,7 @@ protected function _loadVersion($needType) $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), '*'); $rowset = $this->_getReadAdapter()->fetchAll($select); foreach ($rowset as $row) { - self::$_versions[$row['code']] = $row['version']; + self::$_versions[$row['code']] = $row['setup_version']; if (array_key_exists('data_version', $row)) { if (is_null(self::$_dataVersions)) { self::$_dataVersions = []; @@ -91,7 +91,7 @@ public function getDbVersion($resName) */ public function setDbVersion($resName, $version) { - $dbModuleInfo = ['code' => $resName, 'version' => $version]; + $dbModuleInfo = ['code' => $resName, 'setup_version' => $version]; if ($this->getDbVersion($resName)) { self::$_versions[$resName] = $version; diff --git a/lib/internal/Magento/Framework/Module/etc/module.xsd b/lib/internal/Magento/Framework/Module/etc/module.xsd index 34c4b0619c4be..519c6e3508a3a 100644 --- a/lib/internal/Magento/Framework/Module/etc/module.xsd +++ b/lib/internal/Magento/Framework/Module/etc/module.xsd @@ -43,7 +43,7 @@ - + @@ -77,7 +77,7 @@ - + Schema version attribute can contain only [0-9.]. diff --git a/setup/src/Magento/Setup/Module/SetupModule.php b/setup/src/Magento/Setup/Module/SetupModule.php index 761b8c2416f6f..d3b6d1a408bf5 100644 --- a/setup/src/Magento/Setup/Module/SetupModule.php +++ b/setup/src/Magento/Setup/Module/SetupModule.php @@ -26,6 +26,12 @@ class SetupModule extends Setup implements ModuleSchemaResourceInterface */ private $resourceName; + /** + * Setup module name + * @var string + */ + protected $moduleName; + /** * Setup module configuration object * @@ -76,6 +82,7 @@ public function __construct( $this->moduleConfig = $moduleList->getOne($moduleName); $this->resource = new Resource($resource); $this->resourceName = $this->fileResolver->getResourceCode($moduleName); + $this->moduleName = $moduleName; } /** @@ -142,19 +149,19 @@ public function applyUpdates() if (!$this->resourceName) { return $this; } - $dbVer = $this->resource->getDbVersion($this->resourceName); - $configVer = $this->moduleConfig['schema_version']; + $dbVer = $this->resource->getDbVersion($this->moduleName); + $configVer = $this->moduleConfig['setup_version']; // Module is installed if ($dbVer !== false) { if (version_compare($configVer, $dbVer, '>')) { $this->applySchemaUpdates(self::TYPE_DB_UPGRADE, $dbVer, $configVer); - $this->resource->setDbVersion($this->resourceName, $configVer); + $this->resource->setDbVersion($this->moduleName, $configVer); } } elseif ($configVer) { $oldVersion = $this->applySchemaUpdates(self::TYPE_DB_INSTALL, '', $configVer); $this->applySchemaUpdates(self::TYPE_DB_UPGRADE, $oldVersion, $configVer); - $this->resource->setDbVersion($this->resourceName, $configVer); + $this->resource->setDbVersion($this->moduleName, $configVer); } return $this; } @@ -190,7 +197,7 @@ private function applySchemaUpdates($actionType, $fromVersion, $toVersion) } if ($result) { - $this->resource->setDbVersion($this->resourceName, $file['toVersion']); + $this->resource->setDbVersion($this->moduleName, $file['toVersion']); //@todo log } else { //@todo log "Failed resource setup: {$fileName}"; From e1c29934f3118bf5e315ba6426c8754683e23521 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 10 Feb 2015 15:24:05 -0600 Subject: [PATCH 006/106] MAGETWO-33887: Create SPI interfaces and context class - added Readme --- lib/internal/Magento/Framework/Setup/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lib/internal/Magento/Framework/Setup/README.md diff --git a/lib/internal/Magento/Framework/Setup/README.md b/lib/internal/Magento/Framework/Setup/README.md new file mode 100644 index 0000000000000..243b08f57ee4f --- /dev/null +++ b/lib/internal/Magento/Framework/Setup/README.md @@ -0,0 +1,8 @@ +**Setup** provides interfaces that should be used or implemented by Setup data and schema installs/upgrades. + +Implement `InstallSchemaInterface` and/or `UpgradeSchemaInterface` for DB schema install and/or upgrade. +Implement `InstallDataInterface` and/or `UpgradeDataInterface` for DB data install and/or upgrade. + +Setup application provides concrete implementation of a module context and setup DB/schema resources. +Additionally, you may implement `ModuleSchemaResourceInterface` or `ModuleDataResourceInterface`, if your module +requires custom setup resources. From 352e35e7ae86df0a8a3c896ad1a69cf744bbc4d1 Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Tue, 10 Feb 2015 15:47:05 -0600 Subject: [PATCH 007/106] MAGETWO-33884: Changes to database and module.xml - fixed unittest - removed unused resourceName parameter --- .../Framework/Module/DbVersionInfoTest.php | 18 ++++++++---------- .../Magento/Framework/Module/DbVersionInfo.php | 8 ++++---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php index 83add320474cf..f9a23c0d3c2ec 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php @@ -62,14 +62,13 @@ protected function setUp() */ public function testIsDbSchemaUpToDate($moduleName, $dbVersion, $expectedResult) { - $resourceName = 'resource'; $this->moduleResource->expects($this->once()) ->method('getDbVersion') - ->with($resourceName) + ->with($moduleName) ->will($this->returnValue($dbVersion)); $this->assertEquals( $expectedResult, - $this->dbVersionInfo->isSchemaUpToDate($moduleName, $resourceName) + $this->dbVersionInfo->isSchemaUpToDate($moduleName) ); } @@ -82,14 +81,13 @@ public function testIsDbSchemaUpToDate($moduleName, $dbVersion, $expectedResult) */ public function testIsDbDataUpToDate($moduleName, $dbVersion, $expectedResult) { - $resourceName = 'resource'; $this->moduleResource->expects($this->once()) ->method('getDataVersion') - ->with($resourceName) + ->with($moduleName) ->will($this->returnValue($dbVersion)); $this->assertEquals( $expectedResult, - $this->dbVersionInfo->isDataUpToDate($moduleName, $resourceName) + $this->dbVersionInfo->isDataUpToDate($moduleName) ); } @@ -155,19 +153,19 @@ public function testGetDbVersionErrors() /** * @expectedException \UnexpectedValueException - * @expectedExceptionMessage Schema version for module 'Module_No_Schema' is not specified + * @expectedExceptionMessage Setup version for module 'Module_No_Schema' is not specified */ public function testIsDbSchemaUpToDateException() { - $this->dbVersionInfo->isSchemaUpToDate('Module_No_Schema', 'resource_name'); + $this->dbVersionInfo->isSchemaUpToDate('Module_No_Schema'); } /** * @expectedException \UnexpectedValueException - * @expectedExceptionMessage Schema version for module 'Module_No_Schema' is not specified + * @expectedExceptionMessage Setup version for module 'Module_No_Schema' is not specified */ public function testIsDbDataUpToDateException() { - $this->dbVersionInfo->isDataUpToDate('Module_No_Schema', 'resource_name'); + $this->dbVersionInfo->isDataUpToDate('Module_No_Schema'); } } diff --git a/lib/internal/Magento/Framework/Module/DbVersionInfo.php b/lib/internal/Magento/Framework/Module/DbVersionInfo.php index 59afafd18d20d..960e5a89a4508 100644 --- a/lib/internal/Magento/Framework/Module/DbVersionInfo.php +++ b/lib/internal/Magento/Framework/Module/DbVersionInfo.php @@ -59,7 +59,7 @@ public function __construct( * @param string $resourceName * @return bool */ - public function isSchemaUpToDate($moduleName, $resourceName) + public function isSchemaUpToDate($moduleName) { $dbVer = $this->moduleResource->getDbVersion($moduleName); return $this->isModuleVersionEqual($moduleName, $dbVer); @@ -70,7 +70,7 @@ public function isSchemaUpToDate($moduleName, $resourceName) * @param string $resourceName * @return bool */ - public function isDataUpToDate($moduleName, $resourceName) + public function isDataUpToDate($moduleName) { $dataVer = $this->moduleResource->getDataVersion($moduleName); return $this->isModuleVersionEqual($moduleName, $dataVer); @@ -87,11 +87,11 @@ public function getDbVersionErrors() $errors = []; foreach ($this->moduleList->getNames() as $moduleName) { foreach ($this->resourceResolver->getResourceList($moduleName) as $resourceName) { - if (!$this->isSchemaUpToDate($moduleName, $resourceName)) { + if (!$this->isSchemaUpToDate($moduleName)) { $errors[] = $this->getSchemaInfo($moduleName, $resourceName); } - if (!$this->isDataUpToDate($moduleName, $resourceName)) { + if (!$this->isDataUpToDate($moduleName)) { $errors[] = $this->getDataInfo($moduleName, $resourceName); } } From 182d8a92d1f75fcd4e1e8ca8abac120c0a14ac1b Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 10 Feb 2015 16:12:13 -0600 Subject: [PATCH 008/106] MAGETWO-33887: Create SPI interfaces and context class - removed unnecessary "use" statements - fixed name of upgrade method --- lib/internal/Magento/Framework/Setup/InstallDataInterface.php | 2 -- lib/internal/Magento/Framework/Setup/UpgradeDataInterface.php | 4 +--- .../Magento/Framework/Setup/UpgradeSchemaInterface.php | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Setup/InstallDataInterface.php b/lib/internal/Magento/Framework/Setup/InstallDataInterface.php index a53882c242193..e591c357df8aa 100644 --- a/lib/internal/Magento/Framework/Setup/InstallDataInterface.php +++ b/lib/internal/Magento/Framework/Setup/InstallDataInterface.php @@ -5,8 +5,6 @@ */ namespace Magento\Framework\Setup; -use Magento\Framework\Module\DataSetup; - /** * Interface for data installs of a module */ diff --git a/lib/internal/Magento/Framework/Setup/UpgradeDataInterface.php b/lib/internal/Magento/Framework/Setup/UpgradeDataInterface.php index 9cc4c8ae7d863..81b448bac8ea2 100644 --- a/lib/internal/Magento/Framework/Setup/UpgradeDataInterface.php +++ b/lib/internal/Magento/Framework/Setup/UpgradeDataInterface.php @@ -5,8 +5,6 @@ */ namespace Magento\Framework\Setup; -use Magento\Framework\Module\DataSetup; - /** * Interface for data upgrades of a module */ @@ -19,5 +17,5 @@ interface UpgradeDataInterface * @param ModuleContextInterface $context * @return void */ - public function update(ModuleDataResourceInterface $setup, ModuleContextInterface $context); + public function upgrade(ModuleDataResourceInterface $setup, ModuleContextInterface $context); } diff --git a/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php b/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php index b112b1677939f..71695c1117361 100644 --- a/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php +++ b/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php @@ -17,5 +17,5 @@ interface UpgradeSchemaInterface * @param ModuleContextInterface $context * @return void */ - public function update(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context); + public function upgrade(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context); } From 9cb327af675e0d29c3dc1ad8c94a7f296504d9db Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Tue, 10 Feb 2015 17:05:52 -0600 Subject: [PATCH 009/106] MAGETWO-33884: Changes to database and module.xml - Fixed exception message --- .../Magento/Framework/Module/Declaration/Converter/Dom.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Module/Declaration/Converter/Dom.php b/lib/internal/Magento/Framework/Module/Declaration/Converter/Dom.php index 12d86995f00d2..81dea860a4179 100644 --- a/lib/internal/Magento/Framework/Module/Declaration/Converter/Dom.php +++ b/lib/internal/Magento/Framework/Module/Declaration/Converter/Dom.php @@ -29,7 +29,7 @@ public function convert($source) $name = $moduleData['name']; $versionNode = $moduleAttributes->getNamedItem('setup_version'); if (is_null($versionNode)) { - throw new \Exception("Attribute 'schema_version' is missing for module '{$name}'."); + throw new \Exception("Attribute 'setup_version' is missing for module '{$name}'."); } $moduleData['setup_version'] = $versionNode->nodeValue; $moduleData['sequence'] = []; From b0cd24d2aa1b96b16b1d2f2cfedb87008cdf0213 Mon Sep 17 00:00:00 2001 From: Eddie Lau Date: Tue, 10 Feb 2015 16:35:32 -0600 Subject: [PATCH 010/106] MAGETWO-33886: Move sql/data version logic to setup - moved module version registry creation logic from core_setup to Installer - renamed 'core_resource' to 'setup_module' - renamed 'code' to 'module' in setup_module --- .../data/core_setup/data-install-2.0.0.php | 6 ++-- .../Core/sql/core_setup/install-2.0.0.php | 28 --------------- .../Model/Resource/Db/ProfilerTest.php | 10 +++--- .../Framework/Module/DataSetupTest.php | 22 ++++++------ .../_files/dependency_test/tables_ce.php | 1 - .../Magento/Setup/Model/InstallerTest.php | 14 ++++++-- .../factory_table_names/replace_ce.php | 3 +- .../Magento/Framework/Module/Resource.php | 14 ++++---- setup/src/Magento/Setup/Model/Installer.php | 36 +++++++++++++++++++ 9 files changed, 75 insertions(+), 59 deletions(-) diff --git a/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php b/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php index e1f62c89ec61b..66445eb56a101 100644 --- a/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php +++ b/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php @@ -33,11 +33,11 @@ } /** - * Delete rows by condition from core_resource + * Delete rows by condition from setup_module */ -$tableName = $installer->getTable('core_resource'); +$tableName = $installer->getTable('setup_module'); if ($tableName) { - $installer->getConnection()->delete($tableName, ['code = ?' => 'admin_setup']); + $installer->getConnection()->delete($tableName, ['module = ?' => 'admin_setup']); } $installer->endSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/install-2.0.0.php b/app/code/Magento/Core/sql/core_setup/install-2.0.0.php index 517f2901b50cd..657a8006a31e9 100644 --- a/app/code/Magento/Core/sql/core_setup/install-2.0.0.php +++ b/app/code/Magento/Core/sql/core_setup/install-2.0.0.php @@ -12,34 +12,6 @@ $installer->startSetup(); -/** - * Create table 'core_resource' - */ -$table = $connection->newTable( - $installer->getTable('core_resource') -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false, 'primary' => true], - 'Resource Code' -)->addColumn( - 'setup_version', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Resource Version' -)->addColumn( - 'data_version', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Data Version' -)->setComment( - 'Resources' -); -$connection->createTable($table); - /** * Create table 'core_config_data' */ diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/Resource/Db/ProfilerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/Resource/Db/ProfilerTest.php index fb06c0aa1336f..e6e0b0135d202 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Model/Resource/Db/ProfilerTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Model/Resource/Db/ProfilerTest.php @@ -69,7 +69,7 @@ public function testProfilerInit($selectQuery, $queryType) /** @var \Magento\Framework\App\Resource $resource */ $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\App\Resource'); - $testTableName = $resource->getTableName('core_resource'); + $testTableName = $resource->getTableName('setup_module'); $selectQuery = sprintf($selectQuery, $testTableName); $result = $connection->query($selectQuery); @@ -99,18 +99,18 @@ public function profileQueryDataProvider() return [ ["SELECT * FROM %s", \Magento\Framework\DB\Profiler::SELECT], [ - "INSERT INTO %s (code, version, data_version) " . + "INSERT INTO %s (module, version, data_version) " . "VALUES ('" . self::$_testResourceName . "', '1.1', '1.1')", \Magento\Framework\DB\Profiler::INSERT ], [ - "UPDATE %s SET version = '1.2' WHERE code = '" . self::$_testResourceName . "'", + "UPDATE %s SET version = '1.2' WHERE module = '" . self::$_testResourceName . "'", \Magento\Framework\DB\Profiler::UPDATE ], [ - "DELETE FROM %s WHERE code = '" . self::$_testResourceName . "'", + "DELETE FROM %s WHERE module = '" . self::$_testResourceName . "'", \Magento\Framework\DB\Profiler::DELETE ] ]; @@ -135,7 +135,7 @@ public function testProfilerDuringSqlException() /** @var \Magento\Framework\App\Resource $resource */ $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\App\Resource'); - $testTableName = $resource->getTableName('core_resource'); + $testTableName = $resource->getTableName('setup_module'); $connection->query('SELECT * FROM ' . $testTableName); /** @var \Magento\Framework\Model\Resource\Db\Profiler $profiler */ diff --git a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php index 968e5032aae6f..a1a8db73e1ef7 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php @@ -42,22 +42,22 @@ public function testApplyAllDataUpdates() $this->fail("Impossible to continue other tests, because database is broken: {$e}"); } $this->assertNotEmpty( - $this->_model->getTableRow('core_resource', 'code', 'adminnotification_setup', 'version') + $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'version') ); $this->assertNotEmpty( - $this->_model->getTableRow('core_resource', 'code', 'adminnotification_setup', 'data_version') + $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'data_version') ); } public function testUpdateTableRow() { - $original = $this->_model->getTableRow('core_resource', 'code', 'adminnotification_setup', 'version'); - $this->_model->updateTableRow('core_resource', 'code', 'adminnotification_setup', 'version', 'test'); + $original = $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'version'); + $this->_model->updateTableRow('setup_module', 'module', 'adminnotification_setup', 'version', 'test'); $this->assertEquals( 'test', - $this->_model->getTableRow('core_resource', 'code', 'adminnotification_setup', 'version') + $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'version') ); - $this->_model->updateTableRow('core_resource', 'code', 'adminnotification_setup', 'version', $original); + $this->_model->updateTableRow('setup_module', 'module', 'adminnotification_setup', 'version', $original); } /** @@ -65,8 +65,8 @@ public function testUpdateTableRow() */ public function testGetTableRow() { - $this->assertNotEmpty($this->_model->getTableRow('core_resource', 'code', 'core_setup')); - $this->_model->getTableRow('core/resource', 'code', 'core_setup'); + $this->assertNotEmpty($this->_model->getTableRow('setup_module', 'module', 'core_setup')); + $this->_model->getTableRow('setup/module', 'module', 'core_setup'); } /** @@ -74,7 +74,7 @@ public function testGetTableRow() */ public function testDeleteTableRow() { - $this->_model->deleteTableRow('core/resource', 'code', 'integration_test_fixture_setup'); + $this->_model->deleteTableRow('setup/module', 'module', 'integration_test_fixture_setup'); } /** @@ -83,8 +83,8 @@ public function testDeleteTableRow() */ public function testUpdateTableRowNameConversion() { - $original = $this->_model->getTableRow('core_resource', 'code', 'core_setup', 'version'); - $this->_model->updateTableRow('core/resource', 'code', 'core_setup', 'version', $original); + $original = $this->_model->getTableRow('setup_module', 'module', 'core_setup', 'version'); + $this->_model->updateTableRow('setup/module', 'module', 'core_setup', 'version', $original); } public function testTableExists() diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php index 07767f5c8d8cd..4cb0634bac3b1 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php @@ -117,7 +117,6 @@ 'core_flag' => 'Magento_Core', 'core_layout_link' => 'Magento_Core', 'core_layout_update' => 'Magento_Core', - 'core_resource' => 'Magento_Core', 'core_variable' => 'Magento_Core', 'core_variable_value' => 'Magento_Core', 'core_session' => 'Magento_Core', diff --git a/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php b/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php index 72a5dd2da86d5..4445dbe0082ab 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php @@ -119,13 +119,21 @@ protected function setUp() $this->filePermissions = $this->getMock('Magento\Setup\Model\FilePermissions', [], [], '', false); $this->configWriter = $this->getMock('Magento\Framework\App\DeploymentConfig\Writer', [], [], '', false); $this->config = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false); + $setup = $this->getMock('Magento\Setup\Module\Setup', [], [], '', false); + $table = $this->getMock('Magento\Framework\DB\Ddl\Table', [], [], '', false); + $connection = $this->getMockForAbstractClass('Magento\Framework\DB\Adapter\AdapterInterface'); + + $setup->expects($this->any())->method('getConnection')->willReturn($connection); + $table->expects($this->any())->method('addColumn')->willReturn($table); + $table->expects($this->any())->method('setComment')->willReturn($table); + $connection->expects($this->any())->method('newTable')->willReturn($table); + $this->setupFactory = $this->getMock('Magento\Setup\Module\SetupFactory', [], [], '', false); $this->setupFactory->expects($this->any())->method('createSetupModule')->willReturn( $this->getMock('Magento\Setup\Module\SetupModule', [], [], '', false) ); - $this->setupFactory->expects($this->any())->method('createSetup')->willReturn( - $this->getMock('Magento\Setup\Module\Setup', [], [], '', false) - ); + $this->setupFactory->expects($this->any())->method('createSetup')->willReturn($setup); + $this->moduleList = $this->getMockForAbstractClass('Magento\Framework\Module\ModuleListInterface'); $this->moduleList->expects($this->any())->method('getNames')->willReturn( ['Foo_One', 'Bar_Two'] diff --git a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php index f386bfb6e2670..22709dc74790e 100644 --- a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php +++ b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php @@ -134,7 +134,8 @@ 'core/flag' => 'core_flag', 'core/layout_link' => 'core_layout_link', 'core/layout_update' => 'core_layout_update', - 'core/resource' => 'core_resource', + 'core/resource' => 'setup_module', + 'core_resource' => 'setup_module', 'core/session' => 'core_session', 'core/store' => 'store', 'core/store_group' => 'store_group', diff --git a/lib/internal/Magento/Framework/Module/Resource.php b/lib/internal/Magento/Framework/Module/Resource.php index 396c46dbdc237..216d6586264db 100644 --- a/lib/internal/Magento/Framework/Module/Resource.php +++ b/lib/internal/Magento/Framework/Module/Resource.php @@ -35,7 +35,7 @@ class Resource extends \Magento\Framework\Model\Resource\Db\AbstractDb implement */ protected function _construct() { - $this->_init('core_resource', 'code'); + $this->_init('setup_module', 'module'); } /** @@ -60,12 +60,12 @@ protected function _loadVersion($needType) $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), '*'); $rowset = $this->_getReadAdapter()->fetchAll($select); foreach ($rowset as $row) { - self::$_versions[$row['code']] = $row['setup_version']; + self::$_versions[$row['module']] = $row['setup_version']; if (array_key_exists('data_version', $row)) { if (is_null(self::$_dataVersions)) { self::$_dataVersions = []; } - self::$_dataVersions[$row['code']] = $row['data_version']; + self::$_dataVersions[$row['module']] = $row['data_version']; } } } @@ -91,14 +91,14 @@ public function getDbVersion($resName) */ public function setDbVersion($resName, $version) { - $dbModuleInfo = ['code' => $resName, 'setup_version' => $version]; + $dbModuleInfo = ['module' => $resName, 'setup_version' => $version]; if ($this->getDbVersion($resName)) { self::$_versions[$resName] = $version; return $this->_getWriteAdapter()->update( $this->getMainTable(), $dbModuleInfo, - ['code = ?' => $resName] + ['module = ?' => $resName] ); } else { self::$_versions[$resName] = $version; @@ -123,11 +123,11 @@ public function getDataVersion($resName) */ public function setDataVersion($resName, $version) { - $data = ['code' => $resName, 'data_version' => $version]; + $data = ['module' => $resName, 'data_version' => $version]; if ($this->getDbVersion($resName) || $this->getDataVersion($resName)) { self::$_dataVersions[$resName] = $version; - $this->_getWriteAdapter()->update($this->getMainTable(), $data, ['code = ?' => $resName]); + $this->_getWriteAdapter()->update($this->getMainTable(), $data, ['module = ?' => $resName]); } else { self::$_dataVersions[$resName] = $version; $this->_getWriteAdapter()->insert($this->getMainTable(), $data); diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 8c40dcf997c0f..8b9a1901c11ee 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -538,6 +538,41 @@ public function installDeploymentConfig($data) $this->deploymentConfigWriter->create($configs); } + /** + * Set up setup_module table to register modules' versions + * + * @return void + */ + private function setupModuleRegistry() + { + $registrySetup = $this->setupFactory->createSetup(); + $connection = $registrySetup->getConnection(); + /** + * Create table 'setup_module' + */ + $table = $connection->newTable($registrySetup->getTable('setup_module')) + ->addColumn( + 'module', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false, 'primary' => true], + 'Module' + )->addColumn( + 'setup_version', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Resource Version' + )->addColumn( + 'data_version', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Data Version' + )->setComment('Module versions registry'); + $connection->createTable($table); + } + /** * Installs DB schema * @@ -547,6 +582,7 @@ public function installSchema() { $this->assertDeploymentConfigExists(); $this->assertDbAccessible(); + $this->setupModuleRegistry(); $moduleNames = $this->moduleList->getNames(); From da2478e081aeb22794f3d73a2ff3b6a37c60441b Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 11 Feb 2015 09:22:52 -0600 Subject: [PATCH 011/106] MAGETWO-33887: Create SPI interfaces and context class - fixed type of $install in PHPDoc in sql installs/upgrades --- .../Bundle/sql/bundle_setup/install-2.0.0.php | 2 +- .../sql/catalog_setup/install-2.0.0.php | 2 +- .../catalog_setup/upgrade-2.0.0-2.0.0.1.php | 2 +- .../cataloginventory_setup/install-2.0.0.php | 2 +- .../sql/catalogrule_setup/install-2.0.0.php | 4 +- .../sql/catalogsearch_setup/install-2.0.0.php | 2 +- .../catalogurlrewrite_setup/install-2.0.0.php | 2 +- .../install-2.0.0.php | 2 +- .../install-2.0.1.php | 3 +- .../sql/downloadable_setup/install-2.0.0.php | 2 +- app/code/Magento/Eav/Model/Entity/Setup.php | 60 +- .../googleoptimizer_setup/install-2.0.0.php | 3 +- .../googleshopping_setup/install-2.0.0.php | 7 +- .../sql/importexport_setup/install-2.0.0.php | 2 +- .../sql/indexer_setup/install-2.0.0.php | 2 +- .../sql/newsletter_setup/install-2.0.0.php | 7 +- .../Quote/sql/quote_setup/install-2.0.0.php | 123 ++-- .../sql/reports_setup/install-2.0.0.php | 2 +- .../Review/sql/review_setup/install-2.0.0.php | 7 +- .../Sales/sql/sales_setup/install-2.0.0.php | 639 +++++++++--------- .../sql/sales_setup/upgrade-2.0.0-2.0.1.php | 11 +- .../sql/salesrule_setup/install-2.0.0.php | 183 ++--- .../Search/sql/search_setup/install-2.0.0.php | 2 +- app/code/Magento/Tax/Model/Resource/Setup.php | 4 +- .../sql/urlrewrite_setup/install-2.0.0.php | 2 +- .../Magento/Framework/Module/Setup.php | 10 +- 26 files changed, 539 insertions(+), 548 deletions(-) diff --git a/app/code/Magento/Bundle/sql/bundle_setup/install-2.0.0.php b/app/code/Magento/Bundle/sql/bundle_setup/install-2.0.0.php index 5cfc1e9f66f98..c1149834591e5 100644 --- a/app/code/Magento/Bundle/sql/bundle_setup/install-2.0.0.php +++ b/app/code/Magento/Bundle/sql/bundle_setup/install-2.0.0.php @@ -4,8 +4,8 @@ * See COPYING.txt for license details. */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php b/app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php index 279cec9607414..e526ec647d9ea 100644 --- a/app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php +++ b/app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-2.0.0-2.0.0.1.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-2.0.0-2.0.0.1.php index 05001117bb949..3b2e669b511bd 100644 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-2.0.0-2.0.0.1.php +++ b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-2.0.0-2.0.0.1.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-2.0.0.php b/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-2.0.0.php index 50fc39686c189..562d89922a17d 100644 --- a/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-2.0.0.php +++ b/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-2.0.0.php @@ -4,8 +4,8 @@ * See COPYING.txt for license details. */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; -/* @var $installer \Magento\Eav\Model\Entity\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-2.0.0.php b/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-2.0.0.php index b0a281f992865..0387eea1dea6a 100644 --- a/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-2.0.0.php +++ b/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-2.0.0.php @@ -3,9 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ - -/* @var $installer \Magento\Framework\Module\Setup */ - +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-2.0.0.php b/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-2.0.0.php index 6bcac924440d0..50d2c77faf7be 100644 --- a/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-2.0.0.php +++ b/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-2.0.0.php @@ -4,8 +4,8 @@ * See COPYING.txt for license details. */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; -/* @var $installer \Magento\Framework\Module\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-2.0.0.php b/app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-2.0.0.php index 15273a1e93d20..846dee10c7f24 100644 --- a/app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-2.0.0.php +++ b/app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Framework\Module\Setup */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.0.php b/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.0.php index 91b7fdf8e6aeb..9f6efa69cc8a4 100644 --- a/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.0.php +++ b/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.0.php @@ -5,8 +5,8 @@ * See COPYING.txt for license details. */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; -/* @var $installer \Magento\Catalog\Model\Resource\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.1.php b/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.1.php index d53e1577ca5fa..9d496cd3dc7b2 100644 --- a/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.1.php +++ b/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.1.php @@ -4,7 +4,8 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -/* @var $installer \Magento\Catalog\Model\Resource\Setup */ + +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Downloadable/sql/downloadable_setup/install-2.0.0.php b/app/code/Magento/Downloadable/sql/downloadable_setup/install-2.0.0.php index 730c8946db016..edae304c39a5c 100644 --- a/app/code/Magento/Downloadable/sql/downloadable_setup/install-2.0.0.php +++ b/app/code/Magento/Downloadable/sql/downloadable_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Eav/Model/Entity/Setup.php b/app/code/Magento/Eav/Model/Entity/Setup.php index 0bd311e5de5db..f786c65fe9cef 100644 --- a/app/code/Magento/Eav/Model/Entity/Setup.php +++ b/app/code/Magento/Eav/Model/Entity/Setup.php @@ -167,7 +167,7 @@ public function addEntityType($code, array $params) if ($this->getEntityType($code, 'entity_type_id')) { $this->updateEntityType($code, $data); } else { - $this->_connection->insert($this->getTable('eav_entity_type'), $data); + $this->getConnection()->insert($this->getTable('eav_entity_type'), $data); } if (!empty($params['default_group'])) { @@ -261,14 +261,14 @@ public function getAttributeSetSortOrder($entityTypeId, $sortOrder = null) { if (!is_numeric($sortOrder)) { $bind = ['entity_type_id' => $this->getEntityTypeId($entityTypeId)]; - $select = $this->_connection->select()->from( + $select = $this->getConnection()->select()->from( $this->getTable('eav_attribute_set'), 'MAX(sort_order)' )->where( 'entity_type_id = :entity_type_id' ); - $sortOrder = $this->_connection->fetchOne($select, $bind) + 1; + $sortOrder = $this->getConnection()->fetchOne($select, $bind) + 1; } return $sortOrder; @@ -294,7 +294,7 @@ public function addAttributeSet($entityTypeId, $name, $sortOrder = null) if ($setId) { $this->updateAttributeSet($entityTypeId, $setId, $data); } else { - $this->_connection->insert($this->getTable('eav_attribute_set'), $data); + $this->getConnection()->insert($this->getTable('eav_attribute_set'), $data); $this->addAttributeGroup($entityTypeId, $name, $this->_generalGroupName); } @@ -401,7 +401,7 @@ public function setDefaultSetToEntityType($entityType, $attributeSet = 'Default' */ public function getAllAttributeSetIds($entityTypeId = null) { - $select = $this->_connection->select()->from($this->getTable('eav_attribute_set'), 'attribute_set_id'); + $select = $this->getConnection()->select()->from($this->getTable('eav_attribute_set'), 'attribute_set_id'); $bind = []; if ($entityTypeId !== null) { @@ -409,7 +409,7 @@ public function getAllAttributeSetIds($entityTypeId = null) $select->where('entity_type_id = :entity_type_id'); } - return $this->_connection->fetchCol($select, $bind); + return $this->getConnection()->fetchCol($select, $bind); } /** @@ -450,14 +450,14 @@ public function getAttributeGroupSortOrder($entityTypeId, $setId, $sortOrder = n { if (!is_numeric($sortOrder)) { $bind = ['attribute_set_id' => $this->getAttributeSetId($entityTypeId, $setId)]; - $select = $this->_connection->select()->from( + $select = $this->getConnection()->select()->from( $this->getTable('eav_attribute_group'), 'MAX(sort_order)' )->where( 'attribute_set_id = :attribute_set_id' ); - $sortOrder = $this->_connection->fetchOne($select, $bind) + 1; + $sortOrder = $this->getConnection()->fetchOne($select, $bind) + 1; } return $sortOrder; @@ -492,7 +492,7 @@ public function addAttributeGroup($entityTypeId, $setId, $name, $sortOrder = nul if ($sortOrder === null) { $data['sort_order'] = $this->getAttributeGroupSortOrder($entityTypeId, $setId, $sortOrder); } - $this->_connection->insert($this->getTable('eav_attribute_group'), $data); + $this->getConnection()->insert($this->getTable('eav_attribute_group'), $data); } return $this; @@ -637,7 +637,7 @@ public function getDefaultAttributeGroupId($entityType, $attributeSetId = null) */ public function getAttributesNumberInGroup($entityTypeId, $setId, $groupId) { - $select = $this->_connection->select()->from( + $select = $this->getConnection()->select()->from( $this->getTable('eav_entity_attribute'), ['count' => 'COUNT(*)'] )->where( @@ -651,7 +651,7 @@ public function getAttributesNumberInGroup($entityTypeId, $setId, $groupId) $setId ); - return $this->_connection->fetchOne($select); + return $this->getConnection()->fetchOne($select); } /******************* ATTRIBUTES *****************/ @@ -729,12 +729,12 @@ public function addAttribute($entityTypeId, $code, array $attr) } if (!empty($attr['group']) || empty($attr['user_defined'])) { - $select = $this->_connection->select()->from( + $select = $this->getConnection()->select()->from( $this->getTable('eav_attribute_set') )->where( 'entity_type_id = :entity_type_id' ); - $sets = $this->_connection->fetchAll($select, ['entity_type_id' => $entityTypeId]); + $sets = $this->getConnection()->fetchAll($select, ['entity_type_id' => $entityTypeId]); foreach ($sets as $set) { if (!empty($attr['group'])) { $this->addAttributeGroup($entityTypeId, $set['attribute_set_id'], $attr['group']); @@ -785,7 +785,7 @@ public function addAttributeOption($option) if (!empty($option['delete'][$optionId])) { if ($intOptionId) { $condition = ['option_id =?' => $intOptionId]; - $this->_connection->delete($optionTable, $condition); + $this->getConnection()->delete($optionTable, $condition); } continue; } @@ -795,13 +795,13 @@ public function addAttributeOption($option) 'attribute_id' => $option['attribute_id'], 'sort_order' => isset($option['order'][$optionId]) ? $option['order'][$optionId] : 0, ]; - $this->_connection->insert($optionTable, $data); - $intOptionId = $this->_connection->lastInsertId($optionTable); + $this->getConnection()->insert($optionTable, $data); + $intOptionId = $this->getConnection()->lastInsertId($optionTable); } else { $data = [ 'sort_order' => isset($option['order'][$optionId]) ? $option['order'][$optionId] : 0, ]; - $this->_connection->update($optionTable, $data, ['option_id=?' => $intOptionId]); + $this->getConnection()->update($optionTable, $data, ['option_id=?' => $intOptionId]); } // Default value @@ -809,21 +809,21 @@ public function addAttributeOption($option) throw new \Magento\Framework\Model\Exception(__('Default option value is not defined')); } $condition = ['option_id =?' => $intOptionId]; - $this->_connection->delete($optionValueTable, $condition); + $this->getConnection()->delete($optionValueTable, $condition); foreach ($values as $storeId => $value) { $data = ['option_id' => $intOptionId, 'store_id' => $storeId, 'value' => $value]; - $this->_connection->insert($optionValueTable, $data); + $this->getConnection()->insert($optionValueTable, $data); } } } elseif (isset($option['values'])) { foreach ($option['values'] as $sortOrder => $label) { // add option $data = ['attribute_id' => $option['attribute_id'], 'sort_order' => $sortOrder]; - $this->_connection->insert($optionTable, $data); - $intOptionId = $this->_connection->lastInsertId($optionTable); + $this->getConnection()->insert($optionTable, $data); + $intOptionId = $this->getConnection()->lastInsertId($optionTable); $data = ['option_id' => $intOptionId, 'store_id' => 0, 'value' => $label]; - $this->_connection->insert($optionValueTable, $data); + $this->getConnection()->insert($optionValueTable, $data); } } } @@ -965,7 +965,7 @@ public function getAttribute($entityTypeId, $id, $field = null) if (empty($this->_setupCache[$mainTable][$entityTypeId][$id])) { $additionalTable = $this->getTable($additionalTable); $bind = ['id' => $id, 'entity_type_id' => $entityTypeId]; - $select = $this->_connection->select()->from( + $select = $this->getConnection()->select()->from( ['main' => $mainTable] )->join( ['additional' => $additionalTable], @@ -976,7 +976,7 @@ public function getAttribute($entityTypeId, $id, $field = null) 'main.entity_type_id = :entity_type_id' ); - $row = $this->_connection->fetchRow($select, $bind); + $row = $this->getConnection()->fetchRow($select, $bind); if (!$row) { $this->_setupCache[$mainTable][$entityTypeId][$id] = false; } else { @@ -1084,14 +1084,14 @@ public function getAttributeSortOrder($entityTypeId, $setId, $groupId, $sortOrde { if (!is_numeric($sortOrder)) { $bind = ['attribute_group_id' => $this->getAttributeGroupId($entityTypeId, $setId, $groupId)]; - $select = $this->_connection->select()->from( + $select = $this->getConnection()->select()->from( $this->getTable('eav_entity_attribute'), 'MAX(sort_order)' )->where( 'attribute_group_id = :attribute_group_id' ); - $sortOrder = $this->_connection->fetchOne($select, $bind) + 1; + $sortOrder = $this->getConnection()->fetchOne($select, $bind) + 1; } return $sortOrder; @@ -1116,20 +1116,20 @@ public function addAttributeToSet($entityTypeId, $setId, $groupId, $attributeId, $table = $this->getTable('eav_entity_attribute'); $bind = ['attribute_set_id' => $setId, 'attribute_id' => $attributeId]; - $select = $this->_connection->select()->from( + $select = $this->getConnection()->select()->from( $table )->where( 'attribute_set_id = :attribute_set_id' )->where( 'attribute_id = :attribute_id' ); - $result = $this->_connection->fetchRow($select, $bind); + $result = $this->getConnection()->fetchRow($select, $bind); if ($result) { if ($result['attribute_group_id'] != $groupId) { $where = ['entity_attribute_id =?' => $result['entity_attribute_id']]; $data = ['attribute_group_id' => $groupId]; - $this->_connection->update($table, $data, $where); + $this->getConnection()->update($table, $data, $where); } } else { $data = [ @@ -1140,7 +1140,7 @@ public function addAttributeToSet($entityTypeId, $setId, $groupId, $attributeId, 'sort_order' => $this->getAttributeSortOrder($entityTypeId, $setId, $groupId, $sortOrder), ]; - $this->_connection->insert($table, $data); + $this->getConnection()->insert($table, $data); } return $this; diff --git a/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.php b/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.php index 8644cb5b4d382..c08f3ec52c90a 100644 --- a/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.php +++ b/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.php @@ -5,8 +5,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; -/* @var $installer \Magento\Framework\Module\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-2.0.0.php b/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-2.0.0.php index f0db1ff1d051e..a7d60a64bafc7 100644 --- a/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-2.0.0.php +++ b/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-2.0.0.php @@ -4,12 +4,7 @@ * See COPYING.txt for license details. */ -/** - * GoogleShopping install - * - * @author Magento Core Team - */ -/** @var $installer \Magento\Framework\Module\Setup */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/ImportExport/sql/importexport_setup/install-2.0.0.php b/app/code/Magento/ImportExport/sql/importexport_setup/install-2.0.0.php index d727bbc680fde..1796f22c67cc5 100644 --- a/app/code/Magento/ImportExport/sql/importexport_setup/install-2.0.0.php +++ b/app/code/Magento/ImportExport/sql/importexport_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Framework\Module\Setup */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Indexer/sql/indexer_setup/install-2.0.0.php b/app/code/Magento/Indexer/sql/indexer_setup/install-2.0.0.php index 0dbfa72c4994c..5254399e0a22c 100644 --- a/app/code/Magento/Indexer/sql/indexer_setup/install-2.0.0.php +++ b/app/code/Magento/Indexer/sql/indexer_setup/install-2.0.0.php @@ -4,8 +4,8 @@ * See COPYING.txt for license details. */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; -/* @var $installer \Magento\Framework\Module\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/Newsletter/sql/newsletter_setup/install-2.0.0.php b/app/code/Magento/Newsletter/sql/newsletter_setup/install-2.0.0.php index 4cf46f12eb89e..bd04c32f82073 100644 --- a/app/code/Magento/Newsletter/sql/newsletter_setup/install-2.0.0.php +++ b/app/code/Magento/Newsletter/sql/newsletter_setup/install-2.0.0.php @@ -4,13 +4,8 @@ * See COPYING.txt for license details. */ -/** - * Newsletter install - * - * @author Magento Core Team - */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; -/* @var $installer \Magento\Framework\Module\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/Quote/sql/quote_setup/install-2.0.0.php b/app/code/Magento/Quote/sql/quote_setup/install-2.0.0.php index d925c830ca9b1..b33154f4c7688 100644 --- a/app/code/Magento/Quote/sql/quote_setup/install-2.0.0.php +++ b/app/code/Magento/Quote/sql/quote_setup/install-2.0.0.php @@ -4,14 +4,15 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Quote\Model\Resource\Setup */ -$this->startSetup(); +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ +$installer = $this; +$installer->startSetup(); /** * Create table 'quote' */ -$table = $this->getConnection()->newTable( - $this->getTable('quote') +$table = $installer->getConnection()->newTable( + $installer->getTable('quote') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -307,28 +308,28 @@ [], 'Ext Shipping Info' )->addIndex( - $this->getIdxName('quote', ['customer_id', 'store_id', 'is_active']), + $installer->getIdxName('quote', ['customer_id', 'store_id', 'is_active']), ['customer_id', 'store_id', 'is_active'] )->addIndex( - $this->getIdxName('quote', ['store_id']), + $installer->getIdxName('quote', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('quote', 'store_id', 'store', 'store_id'), + $installer->getFkName('quote', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'quote_address' */ -$table = $this->getConnection()->newTable( - $this->getTable('quote_address') +$table = $installer->getConnection()->newTable( + $installer->getTable('quote_address') )->addColumn( 'address_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -660,25 +661,25 @@ [], 'Base Shipping Incl Tax' )->addIndex( - $this->getIdxName('quote_address', ['quote_id']), + $installer->getIdxName('quote_address', ['quote_id']), ['quote_id'] )->addForeignKey( - $this->getFkName('quote_address', 'quote_id', 'quote', 'entity_id'), + $installer->getFkName('quote_address', 'quote_id', 'quote', 'entity_id'), 'quote_id', - $this->getTable('quote'), + $installer->getTable('quote'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Address' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'quote_item' */ -$table = $this->getConnection()->newTable( - $this->getTable('quote_item') +$table = $installer->getConnection()->newTable( + $installer->getTable('quote_item') )->addColumn( 'item_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -932,55 +933,55 @@ [], 'Base Hidden Tax Amount' )->addIndex( - $this->getIdxName('quote_item', ['parent_item_id']), + $installer->getIdxName('quote_item', ['parent_item_id']), ['parent_item_id'] )->addIndex( - $this->getIdxName('quote_item', ['product_id']), + $installer->getIdxName('quote_item', ['product_id']), ['product_id'] )->addIndex( - $this->getIdxName('quote_item', ['quote_id']), + $installer->getIdxName('quote_item', ['quote_id']), ['quote_id'] )->addIndex( - $this->getIdxName('quote_item', ['store_id']), + $installer->getIdxName('quote_item', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('quote_item', 'parent_item_id', 'quote_item', 'item_id'), + $installer->getFkName('quote_item', 'parent_item_id', 'quote_item', 'item_id'), 'parent_item_id', - $this->getTable('quote_item'), + $installer->getTable('quote_item'), 'item_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id'), + $installer->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', - $this->getTable('catalog_product_entity'), + $installer->getTable('catalog_product_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('quote_item', 'quote_id', 'quote', 'entity_id'), + $installer->getFkName('quote_item', 'quote_id', 'quote', 'entity_id'), 'quote_id', - $this->getTable('quote'), + $installer->getTable('quote'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('quote_item', 'store_id', 'store', 'store_id'), + $installer->getFkName('quote_item', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Item' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'quote_address_item' */ -$table = $this->getConnection()->newTable( - $this->getTable('quote_address_item') +$table = $installer->getConnection()->newTable( + $installer->getTable('quote_address_item') )->addColumn( 'address_item_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -1210,55 +1211,55 @@ [], 'Base Hidden Tax Amount' )->addIndex( - $this->getIdxName('quote_address_item', ['quote_address_id']), + $installer->getIdxName('quote_address_item', ['quote_address_id']), ['quote_address_id'] )->addIndex( - $this->getIdxName('quote_address_item', ['parent_item_id']), + $installer->getIdxName('quote_address_item', ['parent_item_id']), ['parent_item_id'] )->addIndex( - $this->getIdxName('quote_address_item', ['quote_item_id']), + $installer->getIdxName('quote_address_item', ['quote_item_id']), ['quote_item_id'] )->addForeignKey( - $this->getFkName( + $installer->getFkName( 'quote_address_item', 'quote_address_id', 'quote_address', 'address_id' ), 'quote_address_id', - $this->getTable('quote_address'), + $installer->getTable('quote_address'), 'address_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName( + $installer->getFkName( 'quote_address_item', 'parent_item_id', 'quote_address_item', 'address_item_id' ), 'parent_item_id', - $this->getTable('quote_address_item'), + $installer->getTable('quote_address_item'), 'address_item_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('quote_address_item', 'quote_item_id', 'quote_item', 'item_id'), + $installer->getFkName('quote_address_item', 'quote_item_id', 'quote_item', 'item_id'), 'quote_item_id', - $this->getTable('quote_item'), + $installer->getTable('quote_item'), 'item_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Address Item' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'quote_item_option' */ -$table = $this->getConnection()->newTable( - $this->getTable('quote_item_option') +$table = $installer->getConnection()->newTable( + $installer->getTable('quote_item_option') )->addColumn( 'option_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -1290,25 +1291,25 @@ [], 'Value' )->addIndex( - $this->getIdxName('quote_item_option', ['item_id']), + $installer->getIdxName('quote_item_option', ['item_id']), ['item_id'] )->addForeignKey( - $this->getFkName('quote_item_option', 'item_id', 'quote_item', 'item_id'), + $installer->getFkName('quote_item_option', 'item_id', 'quote_item', 'item_id'), 'item_id', - $this->getTable('quote_item'), + $installer->getTable('quote_item'), 'item_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Item Option' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'quote_payment' */ -$table = $this->getConnection()->newTable( - $this->getTable('quote_payment') +$table = $installer->getConnection()->newTable( + $installer->getTable('quote_payment') )->addColumn( 'payment_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -1424,25 +1425,25 @@ [], 'Additional Information' )->addIndex( - $this->getIdxName('quote_payment', ['quote_id']), + $installer->getIdxName('quote_payment', ['quote_id']), ['quote_id'] )->addForeignKey( - $this->getFkName('quote_payment', 'quote_id', 'quote', 'entity_id'), + $installer->getFkName('quote_payment', 'quote_id', 'quote', 'entity_id'), 'quote_id', - $this->getTable('quote'), + $installer->getTable('quote'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Payment' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'quote_shipping_rate' */ -$table = $this->getConnection()->newTable( - $this->getTable('quote_shipping_rate') +$table = $installer->getConnection()->newTable( + $installer->getTable('quote_shipping_rate') )->addColumn( 'rate_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -1516,18 +1517,18 @@ [], 'Method Title' )->addIndex( - $this->getIdxName('quote_shipping_rate', ['address_id']), + $installer->getIdxName('quote_shipping_rate', ['address_id']), ['address_id'] )->addForeignKey( - $this->getFkName('quote_shipping_rate', 'address_id', 'quote_address', 'address_id'), + $installer->getFkName('quote_shipping_rate', 'address_id', 'quote_address', 'address_id'), 'address_id', - $this->getTable('quote_address'), + $installer->getTable('quote_address'), 'address_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Shipping Rate' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); -$this->endSetup(); +$installer->endSetup(); diff --git a/app/code/Magento/Reports/sql/reports_setup/install-2.0.0.php b/app/code/Magento/Reports/sql/reports_setup/install-2.0.0.php index a25297fdb2548..9636295c0bda9 100644 --- a/app/code/Magento/Reports/sql/reports_setup/install-2.0.0.php +++ b/app/code/Magento/Reports/sql/reports_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Framework\Module\Setup */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; /* * Prepare database for tables install diff --git a/app/code/Magento/Review/sql/review_setup/install-2.0.0.php b/app/code/Magento/Review/sql/review_setup/install-2.0.0.php index e8a61123b00f2..e12309a7e951a 100644 --- a/app/code/Magento/Review/sql/review_setup/install-2.0.0.php +++ b/app/code/Magento/Review/sql/review_setup/install-2.0.0.php @@ -4,13 +4,8 @@ * See COPYING.txt for license details. */ -/** - * Review install - * - * @author Magento Core Team - */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; -/* @var $installer \Magento\Framework\Module\Setup */ $installer->startSetup(); /** diff --git a/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php b/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php index 5ec898dd6f99a..ea355e2f962b6 100644 --- a/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php +++ b/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php @@ -4,14 +4,15 @@ * See COPYING.txt for license details. */ -/** @var $this \Magento\Sales\Model\Resource\Setup */ -$this->startSetup(); +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ +$installer = $this; +$installer->startSetup(); /** * Create table 'sales_order' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -823,16 +824,16 @@ ['nullable' => true], 'Coupon Sales Rule Name' )->addIndex( - $this->getIdxName('sales_order', ['status']), + $installer->getIdxName('sales_order', ['status']), ['status'] )->addIndex( - $this->getIdxName('sales_order', ['state']), + $installer->getIdxName('sales_order', ['state']), ['state'] )->addIndex( - $this->getIdxName('sales_order', ['store_id']), + $installer->getIdxName('sales_order', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_order', ['increment_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -840,44 +841,44 @@ ['increment_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_order', ['created_at']), + $installer->getIdxName('sales_order', ['created_at']), ['created_at'] )->addIndex( - $this->getIdxName('sales_order', ['customer_id']), + $installer->getIdxName('sales_order', ['customer_id']), ['customer_id'] )->addIndex( - $this->getIdxName('sales_order', ['ext_order_id']), + $installer->getIdxName('sales_order', ['ext_order_id']), ['ext_order_id'] )->addIndex( - $this->getIdxName('sales_order', ['quote_id']), + $installer->getIdxName('sales_order', ['quote_id']), ['quote_id'] )->addIndex( - $this->getIdxName('sales_order', ['updated_at']), + $installer->getIdxName('sales_order', ['updated_at']), ['updated_at'] )->addForeignKey( - $this->getFkName('sales_order', 'customer_id', 'customer_entity', 'entity_id'), + $installer->getFkName('sales_order', 'customer_id', 'customer_entity', 'entity_id'), 'customer_id', - $this->getTable('customer_entity'), + $installer->getTable('customer_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_order', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_order', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Order' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_order_grid' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_grid') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_grid') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -975,25 +976,25 @@ [], 'Updated At' )->addIndex( - $this->getIdxName('sales_order_grid', ['status']), + $installer->getIdxName('sales_order_grid', ['status']), ['status'] )->addIndex( - $this->getIdxName('sales_order_grid', ['store_id']), + $installer->getIdxName('sales_order_grid', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('sales_order_grid', ['base_grand_total']), + $installer->getIdxName('sales_order_grid', ['base_grand_total']), ['base_grand_total'] )->addIndex( - $this->getIdxName('sales_order_grid', ['base_total_paid']), + $installer->getIdxName('sales_order_grid', ['base_total_paid']), ['base_total_paid'] )->addIndex( - $this->getIdxName('sales_order_grid', ['grand_total']), + $installer->getIdxName('sales_order_grid', ['grand_total']), ['grand_total'] )->addIndex( - $this->getIdxName('sales_order_grid', ['total_paid']), + $installer->getIdxName('sales_order_grid', ['total_paid']), ['total_paid'] )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_order_grid', ['increment_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -1001,51 +1002,51 @@ ['increment_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_order_grid', ['shipping_name']), + $installer->getIdxName('sales_order_grid', ['shipping_name']), ['shipping_name'] )->addIndex( - $this->getIdxName('sales_order_grid', ['billing_name']), + $installer->getIdxName('sales_order_grid', ['billing_name']), ['billing_name'] )->addIndex( - $this->getIdxName('sales_order_grid', ['created_at']), + $installer->getIdxName('sales_order_grid', ['created_at']), ['created_at'] )->addIndex( - $this->getIdxName('sales_order_grid', ['customer_id']), + $installer->getIdxName('sales_order_grid', ['customer_id']), ['customer_id'] )->addIndex( - $this->getIdxName('sales_order_grid', ['updated_at']), + $installer->getIdxName('sales_order_grid', ['updated_at']), ['updated_at'] )->addForeignKey( - $this->getFkName('sales_order_grid', 'customer_id', 'customer_entity', 'entity_id'), + $installer->getFkName('sales_order_grid', 'customer_id', 'customer_entity', 'entity_id'), 'customer_id', - $this->getTable('customer_entity'), + $installer->getTable('customer_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_order_grid', 'entity_id', 'sales_order', 'entity_id'), + $installer->getFkName('sales_order_grid', 'entity_id', 'sales_order', 'entity_id'), 'entity_id', - $this->getTable('sales_order'), + $installer->getTable('sales_order'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_order_grid', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_order_grid', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Order Grid' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_order_address' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_address') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_address') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -1173,25 +1174,25 @@ [], 'Company' )->addIndex( - $this->getIdxName('sales_order_address', ['parent_id']), + $installer->getIdxName('sales_order_address', ['parent_id']), ['parent_id'] )->addForeignKey( - $this->getFkName('sales_order_address', 'parent_id', 'sales_order', 'entity_id'), + $installer->getFkName('sales_order_address', 'parent_id', 'sales_order', 'entity_id'), 'parent_id', - $this->getTable('sales_order'), + $installer->getTable('sales_order'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Order Address' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_order_status_history' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_status_history') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status_history') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -1241,28 +1242,28 @@ ['nullable' => true], 'Shows what entity history is bind to.' )->addIndex( - $this->getIdxName('sales_order_status_history', ['parent_id']), + $installer->getIdxName('sales_order_status_history', ['parent_id']), ['parent_id'] )->addIndex( - $this->getIdxName('sales_order_status_history', ['created_at']), + $installer->getIdxName('sales_order_status_history', ['created_at']), ['created_at'] )->addForeignKey( - $this->getFkName('sales_order_status_history', 'parent_id', 'sales_order', 'entity_id'), + $installer->getFkName('sales_order_status_history', 'parent_id', 'sales_order', 'entity_id'), 'parent_id', - $this->getTable('sales_order'), + $installer->getTable('sales_order'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Order Status History' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_order_item' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_item') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_item') )->addColumn( 'item_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -1672,35 +1673,35 @@ [], 'Base Discount Refunded' )->addIndex( - $this->getIdxName('sales_order_item', ['order_id']), + $installer->getIdxName('sales_order_item', ['order_id']), ['order_id'] )->addIndex( - $this->getIdxName('sales_order_item', ['store_id']), + $installer->getIdxName('sales_order_item', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('sales_order_item', 'order_id', 'sales_order', 'entity_id'), + $installer->getFkName('sales_order_item', 'order_id', 'sales_order', 'entity_id'), 'order_id', - $this->getTable('sales_order'), + $installer->getTable('sales_order'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_order_item', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_order_item', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Order Item' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_order_payment' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_payment') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_payment') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -2026,25 +2027,25 @@ [], 'Additional Information' )->addIndex( - $this->getIdxName('sales_order_payment', ['parent_id']), + $installer->getIdxName('sales_order_payment', ['parent_id']), ['parent_id'] )->addForeignKey( - $this->getFkName('sales_order_payment', 'parent_id', 'sales_order', 'entity_id'), + $installer->getFkName('sales_order_payment', 'parent_id', 'sales_order', 'entity_id'), 'parent_id', - $this->getTable('sales_order'), + $installer->getTable('sales_order'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Order Payment' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_shipment' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_shipment') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -2136,13 +2137,13 @@ [], 'Shipping Label Content' )->addIndex( - $this->getIdxName('sales_shipment', ['store_id']), + $installer->getIdxName('sales_shipment', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('sales_shipment', ['total_qty']), + $installer->getIdxName('sales_shipment', ['total_qty']), ['total_qty'] )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_shipment', ['increment_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -2150,38 +2151,38 @@ ['increment_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_shipment', ['order_id']), + $installer->getIdxName('sales_shipment', ['order_id']), ['order_id'] )->addIndex( - $this->getIdxName('sales_shipment', ['created_at']), + $installer->getIdxName('sales_shipment', ['created_at']), ['created_at'] )->addIndex( - $this->getIdxName('sales_shipment', ['updated_at']), + $installer->getIdxName('sales_shipment', ['updated_at']), ['updated_at'] )->addForeignKey( - $this->getFkName('sales_shipment', 'order_id', 'sales_order', 'entity_id'), + $installer->getFkName('sales_shipment', 'order_id', 'sales_order', 'entity_id'), 'order_id', - $this->getTable('sales_order'), + $installer->getTable('sales_order'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_shipment', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_shipment', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Shipment' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_shipment_grid' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_shipment_grid') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_grid') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -2243,19 +2244,19 @@ [], 'Shipping Name' )->addIndex( - $this->getIdxName('sales_shipment_grid', ['store_id']), + $installer->getIdxName('sales_shipment_grid', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('sales_shipment_grid', ['total_qty']), + $installer->getIdxName('sales_shipment_grid', ['total_qty']), ['total_qty'] )->addIndex( - $this->getIdxName('sales_shipment_grid', ['order_id']), + $installer->getIdxName('sales_shipment_grid', ['order_id']), ['order_id'] )->addIndex( - $this->getIdxName('sales_shipment_grid', ['shipment_status']), + $installer->getIdxName('sales_shipment_grid', ['shipment_status']), ['shipment_status'] )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_shipment_grid', ['increment_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -2263,41 +2264,41 @@ ['increment_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_shipment_grid', ['order_increment_id']), + $installer->getIdxName('sales_shipment_grid', ['order_increment_id']), ['order_increment_id'] )->addIndex( - $this->getIdxName('sales_shipment_grid', ['created_at']), + $installer->getIdxName('sales_shipment_grid', ['created_at']), ['created_at'] )->addIndex( - $this->getIdxName('sales_shipment_grid', ['order_created_at']), + $installer->getIdxName('sales_shipment_grid', ['order_created_at']), ['order_created_at'] )->addIndex( - $this->getIdxName('sales_shipment_grid', ['shipping_name']), + $installer->getIdxName('sales_shipment_grid', ['shipping_name']), ['shipping_name'] )->addForeignKey( - $this->getFkName('sales_shipment_grid', 'entity_id', 'sales_shipment', 'entity_id'), + $installer->getFkName('sales_shipment_grid', 'entity_id', 'sales_shipment', 'entity_id'), 'entity_id', - $this->getTable('sales_shipment'), + $installer->getTable('sales_shipment'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_shipment_grid', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_shipment_grid', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Shipment Grid' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_shipment_item' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_shipment_item') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_item') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -2371,25 +2372,25 @@ [], 'Sku' )->addIndex( - $this->getIdxName('sales_shipment_item', ['parent_id']), + $installer->getIdxName('sales_shipment_item', ['parent_id']), ['parent_id'] )->addForeignKey( - $this->getFkName('sales_shipment_item', 'parent_id', 'sales_shipment', 'entity_id'), + $installer->getFkName('sales_shipment_item', 'parent_id', 'sales_shipment', 'entity_id'), 'parent_id', - $this->getTable('sales_shipment'), + $installer->getTable('sales_shipment'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Shipment Item' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_shipment_track' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_shipment_track') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_track') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -2457,31 +2458,31 @@ [], 'Updated At' )->addIndex( - $this->getIdxName('sales_shipment_track', ['parent_id']), + $installer->getIdxName('sales_shipment_track', ['parent_id']), ['parent_id'] )->addIndex( - $this->getIdxName('sales_shipment_track', ['order_id']), + $installer->getIdxName('sales_shipment_track', ['order_id']), ['order_id'] )->addIndex( - $this->getIdxName('sales_shipment_track', ['created_at']), + $installer->getIdxName('sales_shipment_track', ['created_at']), ['created_at'] )->addForeignKey( - $this->getFkName('sales_shipment_track', 'parent_id', 'sales_shipment', 'entity_id'), + $installer->getFkName('sales_shipment_track', 'parent_id', 'sales_shipment', 'entity_id'), 'parent_id', - $this->getTable('sales_shipment'), + $installer->getTable('sales_shipment'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Shipment Track' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_shipment_comment' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_shipment_comment') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_comment') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -2519,28 +2520,28 @@ [], 'Created At' )->addIndex( - $this->getIdxName('sales_shipment_comment', ['created_at']), + $installer->getIdxName('sales_shipment_comment', ['created_at']), ['created_at'] )->addIndex( - $this->getIdxName('sales_shipment_comment', ['parent_id']), + $installer->getIdxName('sales_shipment_comment', ['parent_id']), ['parent_id'] )->addForeignKey( - $this->getFkName('sales_shipment_comment', 'parent_id', 'sales_shipment', 'entity_id'), + $installer->getFkName('sales_shipment_comment', 'parent_id', 'sales_shipment', 'entity_id'), 'parent_id', - $this->getTable('sales_shipment'), + $installer->getTable('sales_shipment'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Shipment Comment' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_invoice' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_invoice') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -2806,19 +2807,19 @@ [], 'Discount Description' )->addIndex( - $this->getIdxName('sales_invoice', ['store_id']), + $installer->getIdxName('sales_invoice', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('sales_invoice', ['grand_total']), + $installer->getIdxName('sales_invoice', ['grand_total']), ['grand_total'] )->addIndex( - $this->getIdxName('sales_invoice', ['order_id']), + $installer->getIdxName('sales_invoice', ['order_id']), ['order_id'] )->addIndex( - $this->getIdxName('sales_invoice', ['state']), + $installer->getIdxName('sales_invoice', ['state']), ['state'] )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_invoice', ['increment_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -2826,32 +2827,32 @@ ['increment_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_invoice', ['created_at']), + $installer->getIdxName('sales_invoice', ['created_at']), ['created_at'] )->addForeignKey( - $this->getFkName('sales_invoice', 'order_id', 'sales_order', 'entity_id'), + $installer->getFkName('sales_invoice', 'order_id', 'sales_order', 'entity_id'), 'order_id', - $this->getTable('sales_order'), + $installer->getTable('sales_order'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_invoice', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_invoice', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Invoice' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_invoice_grid' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_invoice_grid') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice_grid') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -2943,19 +2944,19 @@ [], 'Billing Name' )->addIndex( - $this->getIdxName('sales_invoice_grid', ['store_id']), + $installer->getIdxName('sales_invoice_grid', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('sales_invoice_grid', ['grand_total']), + $installer->getIdxName('sales_invoice_grid', ['grand_total']), ['grand_total'] )->addIndex( - $this->getIdxName('sales_invoice_grid', ['order_id']), + $installer->getIdxName('sales_invoice_grid', ['order_id']), ['order_id'] )->addIndex( - $this->getIdxName('sales_invoice_grid', ['state']), + $installer->getIdxName('sales_invoice_grid', ['state']), ['state'] )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_invoice_grid', ['increment_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -2963,41 +2964,41 @@ ['increment_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_invoice_grid', ['order_increment_id']), + $installer->getIdxName('sales_invoice_grid', ['order_increment_id']), ['order_increment_id'] )->addIndex( - $this->getIdxName('sales_invoice_grid', ['created_at']), + $installer->getIdxName('sales_invoice_grid', ['created_at']), ['created_at'] )->addIndex( - $this->getIdxName('sales_invoice_grid', ['order_created_at']), + $installer->getIdxName('sales_invoice_grid', ['order_created_at']), ['order_created_at'] )->addIndex( - $this->getIdxName('sales_invoice_grid', ['billing_name']), + $installer->getIdxName('sales_invoice_grid', ['billing_name']), ['billing_name'] )->addForeignKey( - $this->getFkName('sales_invoice_grid', 'entity_id', 'sales_invoice', 'entity_id'), + $installer->getFkName('sales_invoice_grid', 'entity_id', 'sales_invoice', 'entity_id'), 'entity_id', - $this->getTable('sales_invoice'), + $installer->getTable('sales_invoice'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_invoice_grid', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_invoice_grid', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Invoice Grid' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_invoice_item' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_invoice_item') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice_item') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -3149,25 +3150,25 @@ [], 'Ratio of tax invoiced over tax of the order item' )->addIndex( - $this->getIdxName('sales_invoice_item', ['parent_id']), + $installer->getIdxName('sales_invoice_item', ['parent_id']), ['parent_id'] )->addForeignKey( - $this->getFkName('sales_invoice_item', 'parent_id', 'sales_invoice', 'entity_id'), + $installer->getFkName('sales_invoice_item', 'parent_id', 'sales_invoice', 'entity_id'), 'parent_id', - $this->getTable('sales_invoice'), + $installer->getTable('sales_invoice'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Invoice Item' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_invoice_comment' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_invoice_comment') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice_comment') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -3205,28 +3206,28 @@ [], 'Created At' )->addIndex( - $this->getIdxName('sales_invoice_comment', ['created_at']), + $installer->getIdxName('sales_invoice_comment', ['created_at']), ['created_at'] )->addIndex( - $this->getIdxName('sales_invoice_comment', ['parent_id']), + $installer->getIdxName('sales_invoice_comment', ['parent_id']), ['parent_id'] )->addForeignKey( - $this->getFkName('sales_invoice_comment', 'parent_id', 'sales_invoice', 'entity_id'), + $installer->getFkName('sales_invoice_comment', 'parent_id', 'sales_invoice', 'entity_id'), 'parent_id', - $this->getTable('sales_invoice'), + $installer->getTable('sales_invoice'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Invoice Comment' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_creditmemo' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_creditmemo') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -3516,16 +3517,16 @@ [], 'Discount Description' )->addIndex( - $this->getIdxName('sales_creditmemo', ['store_id']), + $installer->getIdxName('sales_creditmemo', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('sales_creditmemo', ['order_id']), + $installer->getIdxName('sales_creditmemo', ['order_id']), ['order_id'] )->addIndex( - $this->getIdxName('sales_creditmemo', ['creditmemo_status']), + $installer->getIdxName('sales_creditmemo', ['creditmemo_status']), ['creditmemo_status'] )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_creditmemo', ['increment_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -3533,35 +3534,35 @@ ['increment_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_creditmemo', ['state']), + $installer->getIdxName('sales_creditmemo', ['state']), ['state'] )->addIndex( - $this->getIdxName('sales_creditmemo', ['created_at']), + $installer->getIdxName('sales_creditmemo', ['created_at']), ['created_at'] )->addForeignKey( - $this->getFkName('sales_creditmemo', 'order_id', 'sales_order', 'entity_id'), + $installer->getFkName('sales_creditmemo', 'order_id', 'sales_order', 'entity_id'), 'order_id', - $this->getTable('sales_order'), + $installer->getTable('sales_order'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_creditmemo', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_creditmemo', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Creditmemo' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_creditmemo_grid' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_creditmemo_grid') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo_grid') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -3689,25 +3690,25 @@ [], 'Billing Name' )->addIndex( - $this->getIdxName('sales_creditmemo_grid', ['store_id']), + $installer->getIdxName('sales_creditmemo_grid', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('sales_creditmemo_grid', ['grand_total']), + $installer->getIdxName('sales_creditmemo_grid', ['grand_total']), ['grand_total'] )->addIndex( - $this->getIdxName('sales_creditmemo_grid', ['base_grand_total']), + $installer->getIdxName('sales_creditmemo_grid', ['base_grand_total']), ['base_grand_total'] )->addIndex( - $this->getIdxName('sales_creditmemo_grid', ['order_id']), + $installer->getIdxName('sales_creditmemo_grid', ['order_id']), ['order_id'] )->addIndex( - $this->getIdxName('sales_creditmemo_grid', ['creditmemo_status']), + $installer->getIdxName('sales_creditmemo_grid', ['creditmemo_status']), ['creditmemo_status'] )->addIndex( - $this->getIdxName('sales_creditmemo_grid', ['state']), + $installer->getIdxName('sales_creditmemo_grid', ['state']), ['state'] )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_creditmemo_grid', ['increment_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -3715,41 +3716,41 @@ ['increment_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_creditmemo_grid', ['order_increment_id']), + $installer->getIdxName('sales_creditmemo_grid', ['order_increment_id']), ['order_increment_id'] )->addIndex( - $this->getIdxName('sales_creditmemo_grid', ['created_at']), + $installer->getIdxName('sales_creditmemo_grid', ['created_at']), ['created_at'] )->addIndex( - $this->getIdxName('sales_creditmemo_grid', ['order_created_at']), + $installer->getIdxName('sales_creditmemo_grid', ['order_created_at']), ['order_created_at'] )->addIndex( - $this->getIdxName('sales_creditmemo_grid', ['billing_name']), + $installer->getIdxName('sales_creditmemo_grid', ['billing_name']), ['billing_name'] )->addForeignKey( - $this->getFkName('sales_creditmemo_grid', 'entity_id', 'sales_creditmemo', 'entity_id'), + $installer->getFkName('sales_creditmemo_grid', 'entity_id', 'sales_creditmemo', 'entity_id'), 'entity_id', - $this->getTable('sales_creditmemo'), + $installer->getTable('sales_creditmemo'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_creditmemo_grid', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_creditmemo_grid', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Creditmemo Grid' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_creditmemo_item' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_creditmemo_item') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo_item') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -3901,25 +3902,25 @@ [], 'Ratio of tax in the creditmemo item over tax of the order item' )->addIndex( - $this->getIdxName('sales_creditmemo_item', ['parent_id']), + $installer->getIdxName('sales_creditmemo_item', ['parent_id']), ['parent_id'] )->addForeignKey( - $this->getFkName('sales_creditmemo_item', 'parent_id', 'sales_creditmemo', 'entity_id'), + $installer->getFkName('sales_creditmemo_item', 'parent_id', 'sales_creditmemo', 'entity_id'), 'parent_id', - $this->getTable('sales_creditmemo'), + $installer->getTable('sales_creditmemo'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Creditmemo Item' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_creditmemo_comment' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_creditmemo_comment') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo_comment') )->addColumn( 'entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -3957,28 +3958,28 @@ [], 'Created At' )->addIndex( - $this->getIdxName('sales_creditmemo_comment', ['created_at']), + $installer->getIdxName('sales_creditmemo_comment', ['created_at']), ['created_at'] )->addIndex( - $this->getIdxName('sales_creditmemo_comment', ['parent_id']), + $installer->getIdxName('sales_creditmemo_comment', ['parent_id']), ['parent_id'] )->addForeignKey( - $this->getFkName('sales_creditmemo_comment', 'parent_id', 'sales_creditmemo', 'entity_id'), + $installer->getFkName('sales_creditmemo_comment', 'parent_id', 'sales_creditmemo', 'entity_id'), 'parent_id', - $this->getTable('sales_creditmemo'), + $installer->getTable('sales_creditmemo'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Creditmemo Comment' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_invoiced_aggregated' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_invoiced_aggregated') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoiced_aggregated') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4034,7 +4035,7 @@ [], 'Invoiced Not Captured' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_invoiced_aggregated', ['period', 'store_id', 'order_status'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4042,25 +4043,25 @@ ['period', 'store_id', 'order_status'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_invoiced_aggregated', ['store_id']), + $installer->getIdxName('sales_invoiced_aggregated', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Invoiced Aggregated' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_invoiced_aggregated_order' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_invoiced_aggregated_order') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoiced_aggregated_order') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4116,7 +4117,7 @@ [], 'Invoiced Not Captured' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_invoiced_aggregated_order', ['period', 'store_id', 'order_status'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4124,25 +4125,25 @@ ['period', 'store_id', 'order_status'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_invoiced_aggregated_order', ['store_id']), + $installer->getIdxName('sales_invoiced_aggregated_order', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Invoiced Aggregated Order' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_order_aggregated_created' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_aggregated_created') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_aggregated_created') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4264,7 +4265,7 @@ ['nullable' => false, 'default' => '0.0000'], 'Total Discount Amount Actual' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_order_aggregated_created', ['period', 'store_id', 'order_status'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4272,32 +4273,32 @@ ['period', 'store_id', 'order_status'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_order_aggregated_created', ['store_id']), + $installer->getIdxName('sales_order_aggregated_created', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Order Aggregated Created' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); -$this->getConnection()->createTable( - $this->getConnection()->createTableByDdl( - $this->getTable('sales_order_aggregated_created'), - $this->getTable('sales_order_aggregated_updated') +$installer->getConnection()->createTable( + $installer->getConnection()->createTableByDdl( + $installer->getTable('sales_order_aggregated_created'), + $installer->getTable('sales_order_aggregated_updated') ) ); /** * Create table 'sales_payment_transaction' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_payment_transaction') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_payment_transaction') )->addColumn( 'transaction_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4359,7 +4360,7 @@ [], 'Created At' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_payment_transaction', ['order_id', 'payment_id', 'txn_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4367,42 +4368,42 @@ ['order_id', 'payment_id', 'txn_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_payment_transaction', ['parent_id']), + $installer->getIdxName('sales_payment_transaction', ['parent_id']), ['parent_id'] )->addIndex( - $this->getIdxName('sales_payment_transaction', ['payment_id']), + $installer->getIdxName('sales_payment_transaction', ['payment_id']), ['payment_id'] )->addForeignKey( - $this->getFkName('sales_payment_transaction', 'order_id', 'sales_order', 'entity_id'), + $installer->getFkName('sales_payment_transaction', 'order_id', 'sales_order', 'entity_id'), 'order_id', - $this->getTable('sales_order'), + $installer->getTable('sales_order'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_payment_transaction', 'parent_id', 'sales_payment_transaction', 'transaction_id'), + $installer->getFkName('sales_payment_transaction', 'parent_id', 'sales_payment_transaction', 'transaction_id'), 'parent_id', - $this->getTable('sales_payment_transaction'), + $installer->getTable('sales_payment_transaction'), 'transaction_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_payment_transaction', 'payment_id', 'sales_order_payment', 'entity_id'), + $installer->getFkName('sales_payment_transaction', 'payment_id', 'sales_order_payment', 'entity_id'), 'payment_id', - $this->getTable('sales_order_payment'), + $installer->getTable('sales_order_payment'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Payment Transaction' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_refunded_aggregated' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_refunded_aggregated') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_refunded_aggregated') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4452,7 +4453,7 @@ [], 'Offline Refunded' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_refunded_aggregated', ['period', 'store_id', 'order_status'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4460,25 +4461,25 @@ ['period', 'store_id', 'order_status'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_refunded_aggregated', ['store_id']), + $installer->getIdxName('sales_refunded_aggregated', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Refunded Aggregated' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_refunded_aggregated_order' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_refunded_aggregated_order') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_refunded_aggregated_order') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4528,7 +4529,7 @@ [], 'Offline Refunded' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_refunded_aggregated_order', ['period', 'store_id', 'order_status'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4536,25 +4537,25 @@ ['period', 'store_id', 'order_status'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_refunded_aggregated_order', ['store_id']), + $installer->getIdxName('sales_refunded_aggregated_order', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Refunded Aggregated Order' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_shipping_aggregated' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_shipping_aggregated') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipping_aggregated') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4604,7 +4605,7 @@ [], 'Total Shipping Actual' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_shipping_aggregated', ['period', 'store_id', 'order_status', 'shipping_description'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4612,25 +4613,25 @@ ['period', 'store_id', 'order_status', 'shipping_description'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_shipping_aggregated', ['store_id']), + $installer->getIdxName('sales_shipping_aggregated', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Shipping Aggregated' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_shipping_aggregated_order' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_shipping_aggregated_order') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipping_aggregated_order') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4680,7 +4681,7 @@ [], 'Total Shipping Actual' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_shipping_aggregated_order', ['period', 'store_id', 'order_status', 'shipping_description'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4688,25 +4689,25 @@ ['period', 'store_id', 'order_status', 'shipping_description'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_shipping_aggregated_order', ['store_id']), + $installer->getIdxName('sales_shipping_aggregated_order', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Shipping Aggregated Order' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_bestsellers_aggregated_daily' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_bestsellers_aggregated_daily') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_bestsellers_aggregated_daily') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4756,7 +4757,7 @@ ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Rating Pos' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_bestsellers_aggregated_daily', ['period', 'store_id', 'product_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4764,35 +4765,35 @@ ['period', 'store_id', 'product_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_bestsellers_aggregated_daily', ['store_id']), + $installer->getIdxName('sales_bestsellers_aggregated_daily', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('sales_bestsellers_aggregated_daily', ['product_id']), + $installer->getIdxName('sales_bestsellers_aggregated_daily', ['product_id']), ['product_id'] )->addForeignKey( - $this->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_bestsellers_aggregated_daily', 'product_id', 'catalog_product_entity', 'entity_id'), + $installer->getFkName('sales_bestsellers_aggregated_daily', 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', - $this->getTable('catalog_product_entity'), + $installer->getTable('catalog_product_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Bestsellers Aggregated Daily' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_bestsellers_aggregated_monthly' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_bestsellers_aggregated_monthly') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_bestsellers_aggregated_monthly') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4842,7 +4843,7 @@ ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Rating Pos' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_bestsellers_aggregated_monthly', ['period', 'store_id', 'product_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4850,35 +4851,35 @@ ['period', 'store_id', 'product_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_bestsellers_aggregated_monthly', ['store_id']), + $installer->getIdxName('sales_bestsellers_aggregated_monthly', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('sales_bestsellers_aggregated_monthly', ['product_id']), + $installer->getIdxName('sales_bestsellers_aggregated_monthly', ['product_id']), ['product_id'] )->addForeignKey( - $this->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_bestsellers_aggregated_monthly', 'product_id', 'catalog_product_entity', 'entity_id'), + $installer->getFkName('sales_bestsellers_aggregated_monthly', 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', - $this->getTable('catalog_product_entity'), + $installer->getTable('catalog_product_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Bestsellers Aggregated Monthly' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_bestsellers_aggregated_yearly' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_bestsellers_aggregated_yearly') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_bestsellers_aggregated_yearly') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -4928,7 +4929,7 @@ ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Rating Pos' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'sales_bestsellers_aggregated_yearly', ['period', 'store_id', 'product_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -4936,35 +4937,35 @@ ['period', 'store_id', 'product_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('sales_bestsellers_aggregated_yearly', ['store_id']), + $installer->getIdxName('sales_bestsellers_aggregated_yearly', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('sales_bestsellers_aggregated_yearly', ['product_id']), + $installer->getIdxName('sales_bestsellers_aggregated_yearly', ['product_id']), ['product_id'] )->addForeignKey( - $this->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_bestsellers_aggregated_yearly', 'product_id', 'catalog_product_entity', 'entity_id'), + $installer->getFkName('sales_bestsellers_aggregated_yearly', 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', - $this->getTable('catalog_product_entity'), + $installer->getTable('catalog_product_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Bestsellers Aggregated Yearly' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_order_tax' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_tax') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_tax') )->addColumn( 'tax_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -5038,18 +5039,18 @@ ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Hidden' )->addIndex( - $this->getIdxName('sales_order_tax', ['order_id', 'priority', 'position']), + $installer->getIdxName('sales_order_tax', ['order_id', 'priority', 'position']), ['order_id', 'priority', 'position'] )->setComment( 'Sales Order Tax Table' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_order_status' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_status') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status') )->addColumn( 'status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, @@ -5065,13 +5066,13 @@ )->setComment( 'Sales Order Status Table' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_order_status_state' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_status_state') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status_state') )->addColumn( 'status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, @@ -5097,22 +5098,22 @@ ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Visible on front' )->addForeignKey( - $this->getFkName('sales_order_status_state', 'status', 'sales_order_status', 'status'), + $installer->getFkName('sales_order_status_state', 'status', 'sales_order_status', 'status'), 'status', - $this->getTable('sales_order_status'), + $installer->getTable('sales_order_status'), 'status', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Order Status Table' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'sales_order_status_label' */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_status_label') +$table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status_label') )->addColumn( 'status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, @@ -5132,25 +5133,25 @@ ['nullable' => false], 'Label' )->addIndex( - $this->getIdxName('sales_order_status_label', ['store_id']), + $installer->getIdxName('sales_order_status_label', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('sales_order_status_label', 'status', 'sales_order_status', 'status'), + $installer->getFkName('sales_order_status_label', 'status', 'sales_order_status', 'status'), 'status', - $this->getTable('sales_order_status'), + $installer->getTable('sales_order_status'), 'status', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'), + $installer->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Order Status Label Table' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); -$this->endSetup(); +$installer->endSetup(); diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-2.0.0-2.0.1.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-2.0.0-2.0.1.php index 8227c08b2ad4e..13cdad22d5bab 100644 --- a/app/code/Magento/Sales/sql/sales_setup/upgrade-2.0.0-2.0.1.php +++ b/app/code/Magento/Sales/sql/sales_setup/upgrade-2.0.0-2.0.1.php @@ -6,6 +6,9 @@ use Magento\Framework\DB\Ddl\Table; +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ +$installer = $this; + /** * update columns created_at and updated_at in sales entities tables */ @@ -24,19 +27,19 @@ 'sales_shipment_track' ]; /** @var \Magento\Framework\DB\Adapter\AdapterInterface $connection */ -$connection = $this->getConnection(); +$connection = $installer->getConnection(); foreach ($tables as $table) { - $columns = $connection->describeTable($this->getTable($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($this->getTable($table), 'created_at', $createdAt); + $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($this->getTable($table), 'updated_at', $updatedAt); + $connection->modifyColumn($installer->getTable($table), 'updated_at', $updatedAt); } } diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php b/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php index e9d717372a503..eb7d8f0157b37 100644 --- a/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php +++ b/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php @@ -4,14 +4,15 @@ * See COPYING.txt for license details. */ -/* @var $this \Magento\Framework\Module\Setup */ -$this->startSetup(); +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ +$installer = $this; +$installer->startSetup(); /** * Create table 'salesrule' */ -$table = $this->getConnection()->newTable( - $this->getTable('salesrule') +$table = $installer->getConnection()->newTable( + $installer->getTable('salesrule') )->addColumn( 'rule_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -151,18 +152,18 @@ ['nullable' => false, 'default' => 0], 'User Per Coupon' )->addIndex( - $this->getIdxName('salesrule', ['is_active', 'sort_order', 'to_date', 'from_date']), + $installer->getIdxName('salesrule', ['is_active', 'sort_order', 'to_date', 'from_date']), ['is_active', 'sort_order', 'to_date', 'from_date'] )->setComment( 'Salesrule' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'salesrule_coupon' */ -$table = $this->getConnection()->newTable( - $this->getTable('salesrule_coupon') +$table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon') )->addColumn( 'coupon_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -224,7 +225,7 @@ ['nullable' => true, 'default' => 0], 'Coupon Code Type' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'salesrule_coupon', ['code'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -232,7 +233,7 @@ ['code'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'salesrule_coupon', ['rule_id', 'is_primary'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -240,25 +241,25 @@ ['rule_id', 'is_primary'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('salesrule_coupon', ['rule_id']), + $installer->getIdxName('salesrule_coupon', ['rule_id']), ['rule_id'] )->addForeignKey( - $this->getFkName('salesrule_coupon', 'rule_id', 'salesrule', 'rule_id'), + $installer->getFkName('salesrule_coupon', 'rule_id', 'salesrule', 'rule_id'), 'rule_id', - $this->getTable('salesrule'), + $installer->getTable('salesrule'), 'rule_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Salesrule Coupon' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'salesrule_coupon_usage' */ -$table = $this->getConnection()->newTable( - $this->getTable('salesrule_coupon_usage') +$table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon_usage') )->addColumn( 'coupon_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -278,32 +279,32 @@ ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Times Used' )->addIndex( - $this->getIdxName('salesrule_coupon_usage', ['customer_id']), + $installer->getIdxName('salesrule_coupon_usage', ['customer_id']), ['customer_id'] )->addForeignKey( - $this->getFkName('salesrule_coupon_usage', 'coupon_id', 'salesrule_coupon', 'coupon_id'), + $installer->getFkName('salesrule_coupon_usage', 'coupon_id', 'salesrule_coupon', 'coupon_id'), 'coupon_id', - $this->getTable('salesrule_coupon'), + $installer->getTable('salesrule_coupon'), 'coupon_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'), + $installer->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'), 'customer_id', - $this->getTable('customer_entity'), + $installer->getTable('customer_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Salesrule Coupon Usage' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'salesrule_customer' */ -$table = $this->getConnection()->newTable( - $this->getTable('salesrule_customer') +$table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_customer') )->addColumn( 'rule_customer_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -329,35 +330,35 @@ ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Times Used' )->addIndex( - $this->getIdxName('salesrule_customer', ['rule_id', 'customer_id']), + $installer->getIdxName('salesrule_customer', ['rule_id', 'customer_id']), ['rule_id', 'customer_id'] )->addIndex( - $this->getIdxName('salesrule_customer', ['customer_id', 'rule_id']), + $installer->getIdxName('salesrule_customer', ['customer_id', 'rule_id']), ['customer_id', 'rule_id'] )->addForeignKey( - $this->getFkName('salesrule_customer', 'customer_id', 'customer_entity', 'entity_id'), + $installer->getFkName('salesrule_customer', 'customer_id', 'customer_entity', 'entity_id'), 'customer_id', - $this->getTable('customer_entity'), + $installer->getTable('customer_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'), + $installer->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'), 'rule_id', - $this->getTable('salesrule'), + $installer->getTable('salesrule'), 'rule_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Salesrule Customer' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'salesrule_label' */ -$table = $this->getConnection()->newTable( - $this->getTable('salesrule_label') +$table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_label') )->addColumn( 'label_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -383,7 +384,7 @@ [], 'Label' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'salesrule_label', ['rule_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -391,32 +392,32 @@ ['rule_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('salesrule_label', ['store_id']), + $installer->getIdxName('salesrule_label', ['store_id']), ['store_id'] )->addForeignKey( - $this->getFkName('salesrule_label', 'rule_id', 'salesrule', 'rule_id'), + $installer->getFkName('salesrule_label', 'rule_id', 'salesrule', 'rule_id'), 'rule_id', - $this->getTable('salesrule'), + $installer->getTable('salesrule'), 'rule_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('salesrule_label', 'store_id', 'store', 'store_id'), + $installer->getFkName('salesrule_label', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Salesrule Label' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'salesrule_product_attribute' */ -$table = $this->getConnection()->newTable( - $this->getTable('salesrule_product_attribute') +$table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_product_attribute') )->addColumn( 'rule_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -442,52 +443,52 @@ ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Attribute Id' )->addIndex( - $this->getIdxName('salesrule_product_attribute', ['website_id']), + $installer->getIdxName('salesrule_product_attribute', ['website_id']), ['website_id'] )->addIndex( - $this->getIdxName('salesrule_product_attribute', ['customer_group_id']), + $installer->getIdxName('salesrule_product_attribute', ['customer_group_id']), ['customer_group_id'] )->addIndex( - $this->getIdxName('salesrule_product_attribute', ['attribute_id']), + $installer->getIdxName('salesrule_product_attribute', ['attribute_id']), ['attribute_id'] )->addForeignKey( - $this->getFkName('salesrule_product_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + $installer->getFkName('salesrule_product_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), 'attribute_id', - $this->getTable('eav_attribute'), + $installer->getTable('eav_attribute'), 'attribute_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION )->addForeignKey( - $this->getFkName('salesrule_product_attribute', 'customer_group_id', 'customer_group', 'customer_group_id'), + $installer->getFkName('salesrule_product_attribute', 'customer_group_id', 'customer_group', 'customer_group_id'), 'customer_group_id', - $this->getTable('customer_group'), + $installer->getTable('customer_group'), 'customer_group_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION )->addForeignKey( - $this->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'), + $installer->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'), 'rule_id', - $this->getTable('salesrule'), + $installer->getTable('salesrule'), 'rule_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION )->addForeignKey( - $this->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'), + $installer->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'), 'website_id', - $this->getTable('store_website'), + $installer->getTable('store_website'), 'website_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION )->setComment( 'Salesrule Product Attribute' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'salesrule_coupon_aggregated' */ -$table = $this->getConnection()->newTable( - $this->getTable('salesrule_coupon_aggregated') +$table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon_aggregated') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -567,7 +568,7 @@ [], 'Rule Name' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'salesrule_coupon_aggregated', ['period', 'store_id', 'order_status', 'coupon_code'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -575,35 +576,35 @@ ['period', 'store_id', 'order_status', 'coupon_code'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('salesrule_coupon_aggregated', ['store_id']), + $installer->getIdxName('salesrule_coupon_aggregated', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('salesrule_coupon_aggregated', ['rule_name']), + $installer->getIdxName('salesrule_coupon_aggregated', ['rule_name']), ['rule_name'] )->addForeignKey( - $this->getFkName('salesrule_coupon_aggregated', 'store_id', 'store', 'store_id'), + $installer->getFkName('salesrule_coupon_aggregated', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Coupon Aggregated' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); -$this->getConnection()->createTable( - $this->getConnection()->createTableByDdl( - $this->getTable('salesrule_coupon_aggregated'), - $this->getTable('salesrule_coupon_aggregated_updated') +$installer->getConnection()->createTable( + $installer->getConnection()->createTableByDdl( + $installer->getTable('salesrule_coupon_aggregated'), + $installer->getTable('salesrule_coupon_aggregated_updated') ) ); /** * Create table 'salesrule_coupon_aggregated_order' */ -$table = $this->getConnection()->newTable( - $this->getTable('salesrule_coupon_aggregated_order') +$table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon_aggregated_order') )->addColumn( 'id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -665,7 +666,7 @@ [], 'Rule Name' )->addIndex( - $this->getIdxName( + $installer->getIdxName( 'salesrule_coupon_aggregated_order', ['period', 'store_id', 'order_status', 'coupon_code'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE @@ -673,33 +674,33 @@ ['period', 'store_id', 'order_status', 'coupon_code'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( - $this->getIdxName('salesrule_coupon_aggregated_order', ['store_id']), + $installer->getIdxName('salesrule_coupon_aggregated_order', ['store_id']), ['store_id'] )->addIndex( - $this->getIdxName('salesrule_coupon_aggregated_order', ['rule_name']), + $installer->getIdxName('salesrule_coupon_aggregated_order', ['rule_name']), ['rule_name'] )->addForeignKey( - $this->getFkName('salesrule_coupon_aggregated_order', 'store_id', 'store', 'store_id'), + $installer->getFkName('salesrule_coupon_aggregated_order', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('store'), + $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Coupon Aggregated Order' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); -$websitesTable = $this->getTable('store_website'); -$customerGroupsTable = $this->getTable('customer_group'); -$rulesWebsitesTable = $this->getTable('salesrule_website'); -$rulesCustomerGroupsTable = $this->getTable('salesrule_customer_group'); +$websitesTable = $installer->getTable('store_website'); +$customerGroupsTable = $installer->getTable('customer_group'); +$rulesWebsitesTable = $installer->getTable('salesrule_website'); +$rulesCustomerGroupsTable = $installer->getTable('salesrule_customer_group'); /** * Create table 'salesrule_website' if not exists. This table will be used instead of * column website_ids of main catalog rules table */ -$table = $this->getConnection()->newTable( +$table = $installer->getConnection()->newTable( $rulesWebsitesTable )->addColumn( 'rule_id', @@ -714,17 +715,17 @@ ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Website Id' )->addIndex( - $this->getIdxName('salesrule_website', ['website_id']), + $installer->getIdxName('salesrule_website', ['website_id']), ['website_id'] )->addForeignKey( - $this->getFkName('salesrule_website', 'rule_id', 'salesrule', 'rule_id'), + $installer->getFkName('salesrule_website', 'rule_id', 'salesrule', 'rule_id'), 'rule_id', - $this->getTable('salesrule'), + $installer->getTable('salesrule'), 'rule_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'), + $installer->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'), 'website_id', $websitesTable, 'website_id', @@ -734,13 +735,13 @@ 'Sales Rules To Websites Relations' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); /** * Create table 'salesrule_customer_group' if not exists. This table will be used instead of * column customer_group_ids of main catalog rules table */ -$table = $this->getConnection()->newTable( +$table = $installer->getConnection()->newTable( $rulesCustomerGroupsTable )->addColumn( 'rule_id', @@ -755,17 +756,17 @@ ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Customer Group Id' )->addIndex( - $this->getIdxName('salesrule_customer_group', ['customer_group_id']), + $installer->getIdxName('salesrule_customer_group', ['customer_group_id']), ['customer_group_id'] )->addForeignKey( - $this->getFkName('salesrule_customer_group', 'rule_id', 'salesrule', 'rule_id'), + $installer->getFkName('salesrule_customer_group', 'rule_id', 'salesrule', 'rule_id'), 'rule_id', - $this->getTable('salesrule'), + $installer->getTable('salesrule'), 'rule_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('salesrule_customer_group', 'customer_group_id', 'customer_group', 'customer_group_id'), + $installer->getFkName('salesrule_customer_group', 'customer_group_id', 'customer_group', 'customer_group_id'), 'customer_group_id', $customerGroupsTable, 'customer_group_id', @@ -775,6 +776,6 @@ 'Sales Rules To Customer Groups Relations' ); -$this->getConnection()->createTable($table); +$installer->getConnection()->createTable($table); -$this->endSetup(); +$installer->endSetup(); diff --git a/app/code/Magento/Search/sql/search_setup/install-2.0.0.php b/app/code/Magento/Search/sql/search_setup/install-2.0.0.php index ee1f6e6af2e67..c5f0cd16a71ad 100644 --- a/app/code/Magento/Search/sql/search_setup/install-2.0.0.php +++ b/app/code/Magento/Search/sql/search_setup/install-2.0.0.php @@ -4,8 +4,8 @@ * See COPYING.txt for license details. */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; -/* @var $installer \Magento\Framework\Module\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/Tax/Model/Resource/Setup.php b/app/code/Magento/Tax/Model/Resource/Setup.php index 20b4b000e5916..d28abe213f39b 100644 --- a/app/code/Magento/Tax/Model/Resource/Setup.php +++ b/app/code/Magento/Tax/Model/Resource/Setup.php @@ -65,9 +65,9 @@ public function __construct( protected function _loadTableData($table) { $table = $this->getTable($table); - $select = $this->_connection->select(); + $select = $this->getConnection()->select(); $select->from($table); - return $this->_connection->fetchAll($select); + return $this->getConnection()->fetchAll($select); } /** diff --git a/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-2.0.0.php b/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-2.0.0.php index 2136aaa0c59ca..ae3c838723bbf 100644 --- a/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-2.0.0.php +++ b/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-2.0.0.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/* @var $installer \Magento\Theme\Model\Resource\Setup */ +/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ $installer = $this; $installer->startSetup(); diff --git a/lib/internal/Magento/Framework/Module/Setup.php b/lib/internal/Magento/Framework/Module/Setup.php index 6b9d7ba36dcb5..86ca4f2b24b72 100644 --- a/lib/internal/Magento/Framework/Module/Setup.php +++ b/lib/internal/Magento/Framework/Module/Setup.php @@ -17,28 +17,28 @@ class Setup implements ResourceInterface * * @var \Magento\Framework\DB\Adapter\Pdo\Mysql */ - protected $_connection = null; + private $_connection = null; /** * Tables cache array * * @var array */ - protected $_tables = []; + private $_tables = []; /** * Modules configuration * * @var \Magento\Framework\App\Resource */ - protected $_resourceModel; + private $_resourceModel; /** * Connection instance name * * @var string */ - protected $_connectionName; + private $_connectionName; /** * @param \Magento\Framework\App\Resource $resource @@ -99,7 +99,7 @@ public function getTable($tableName) * @param string|array $tableName * @return string */ - protected function _getTableCacheName($tableName) + private function _getTableCacheName($tableName) { if (is_array($tableName)) { return join('_', $tableName); From a80f51f369f1a751816a592e81c07c9c525939dc Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Wed, 11 Feb 2015 10:51:00 -0600 Subject: [PATCH 012/106] MAGETWO-33884: Changes to database and module.xml - Fixed column name setup_version->schema_version - Fixed integration tests. --- .../Framework/Model/Resource/Db/ProfilerTest.php | 4 ++-- .../Magento/Framework/Module/DataSetupTest.php | 14 +++++++------- lib/internal/Magento/Framework/Module/Resource.php | 4 ++-- setup/src/Magento/Setup/Model/Installer.php | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/Resource/Db/ProfilerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/Resource/Db/ProfilerTest.php index e6e0b0135d202..955772f912ce2 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Model/Resource/Db/ProfilerTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Model/Resource/Db/ProfilerTest.php @@ -99,14 +99,14 @@ public function profileQueryDataProvider() return [ ["SELECT * FROM %s", \Magento\Framework\DB\Profiler::SELECT], [ - "INSERT INTO %s (module, version, data_version) " . + "INSERT INTO %s (module, schema_version, data_version) " . "VALUES ('" . self::$_testResourceName . "', '1.1', '1.1')", \Magento\Framework\DB\Profiler::INSERT ], [ - "UPDATE %s SET version = '1.2' WHERE module = '" . self::$_testResourceName . "'", + "UPDATE %s SET schema_version = '1.2' WHERE module = '" . self::$_testResourceName . "'", \Magento\Framework\DB\Profiler::UPDATE ], [ diff --git a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php index a1a8db73e1ef7..26a1a4871af4d 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php @@ -42,7 +42,7 @@ public function testApplyAllDataUpdates() $this->fail("Impossible to continue other tests, because database is broken: {$e}"); } $this->assertNotEmpty( - $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'version') + $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'schema_version') ); $this->assertNotEmpty( $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'data_version') @@ -51,13 +51,13 @@ public function testApplyAllDataUpdates() public function testUpdateTableRow() { - $original = $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'version'); - $this->_model->updateTableRow('setup_module', 'module', 'adminnotification_setup', 'version', 'test'); + $original = $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'schema_version'); + $this->_model->updateTableRow('setup_module', 'module', 'adminnotification_setup', 'schema_version', 'test'); $this->assertEquals( 'test', - $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'version') + $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'schema_version') ); - $this->_model->updateTableRow('setup_module', 'module', 'adminnotification_setup', 'version', $original); + $this->_model->updateTableRow('setup_module', 'module', 'adminnotification_setup', 'schema_version', $original); } /** @@ -83,8 +83,8 @@ public function testDeleteTableRow() */ public function testUpdateTableRowNameConversion() { - $original = $this->_model->getTableRow('setup_module', 'module', 'core_setup', 'version'); - $this->_model->updateTableRow('setup/module', 'module', 'core_setup', 'version', $original); + $original = $this->_model->getTableRow('setup_module', 'module', 'core_setup', 'schema_version'); + $this->_model->updateTableRow('setup/module', 'module', 'core_setup', 'schema_version', $original); } public function testTableExists() diff --git a/lib/internal/Magento/Framework/Module/Resource.php b/lib/internal/Magento/Framework/Module/Resource.php index 216d6586264db..3dcabfbb789d2 100644 --- a/lib/internal/Magento/Framework/Module/Resource.php +++ b/lib/internal/Magento/Framework/Module/Resource.php @@ -60,7 +60,7 @@ protected function _loadVersion($needType) $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), '*'); $rowset = $this->_getReadAdapter()->fetchAll($select); foreach ($rowset as $row) { - self::$_versions[$row['module']] = $row['setup_version']; + self::$_versions[$row['module']] = $row['schema_version']; if (array_key_exists('data_version', $row)) { if (is_null(self::$_dataVersions)) { self::$_dataVersions = []; @@ -91,7 +91,7 @@ public function getDbVersion($resName) */ public function setDbVersion($resName, $version) { - $dbModuleInfo = ['module' => $resName, 'setup_version' => $version]; + $dbModuleInfo = ['module' => $resName, 'schema_version' => $version]; if ($this->getDbVersion($resName)) { self::$_versions[$resName] = $version; diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 8b9a1901c11ee..0c1dcb5387f7a 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -558,11 +558,11 @@ private function setupModuleRegistry() ['nullable' => false, 'primary' => true], 'Module' )->addColumn( - 'setup_version', + 'schema_version', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 50, [], - 'Resource Version' + 'Schema Version' )->addColumn( 'data_version', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, From 5c19d88ceb027ee274b00b41a69e509ef12e7d18 Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Wed, 11 Feb 2015 13:31:19 -0600 Subject: [PATCH 013/106] MAGETWO-33884: Changes to database and module.xml - Fixed functional test again. --- .../Magento/Framework/Module/DataSetupTest.php | 12 ++++++------ .../Module/Plugin/DbStatusValidatorTest.php | 12 +++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php index 26a1a4871af4d..95eaa16633273 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php @@ -42,22 +42,22 @@ public function testApplyAllDataUpdates() $this->fail("Impossible to continue other tests, because database is broken: {$e}"); } $this->assertNotEmpty( - $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'schema_version') + $this->_model->getTableRow('setup_module', 'module', 'Magento_AdminNotification', 'schema_version') ); $this->assertNotEmpty( - $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'data_version') + $this->_model->getTableRow('setup_module', 'module', 'Magento_AdminNotification', 'data_version') ); } public function testUpdateTableRow() { - $original = $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'schema_version'); - $this->_model->updateTableRow('setup_module', 'module', 'adminnotification_setup', 'schema_version', 'test'); + $original = $this->_model->getTableRow('setup_module', 'module', 'Magento_AdminNotification', 'schema_version'); + $this->_model->updateTableRow('setup_module', 'module', 'Magento_AdminNotification', 'schema_version', 'test'); $this->assertEquals( 'test', - $this->_model->getTableRow('setup_module', 'module', 'adminnotification_setup', 'schema_version') + $this->_model->getTableRow('setup_module', 'module', 'Magento_AdminNotification', 'schema_version') ); - $this->_model->updateTableRow('setup_module', 'module', 'adminnotification_setup', 'schema_version', $original); + $this->_model->updateTableRow('setup_module', 'module', 'Magento_AdminNotification', 'schema_version', $original); } /** diff --git a/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php index 94ec824ecb939..8faf6cccc51ab 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php @@ -27,19 +27,17 @@ public function testValidationOutdatedDb() /** @var \Magento\Framework\Module\ResourceResolverInterface $resourceResolver */ $resourceResolver = $objectManager->get('Magento\Framework\Module\ResourceResolverInterface'); - // get first resource, we don't care which one it is. + // get first module name, we don't care which one it is. foreach ($moduleList->getNames() as $moduleName) { - if ($resourceList = $resourceResolver->getResourceList($moduleName)) { - $resourceName = $resourceList[0]; - break; - } + $moduleNameToTest = $moduleName; + break; } // Prepend '0.' to DB Version, to cause it to be an older version /** @var \Magento\Framework\Module\ResourceInterface $resource */ $resource = $objectManager->create('Magento\Framework\Module\ResourceInterface'); - $currentDbVersion = $resource->getDbVersion($resourceName); - $resource->setDbVersion($resourceName, '0.' . $currentDbVersion); + $currentDbVersion = $resource->getDbVersion($moduleNameToTest); + $resource->setDbVersion($moduleNameToTest, '0.' . $currentDbVersion); /** @var \Magento\Framework\Cache\FrontendInterface $cache */ $cache = $this->_objectManager->get('Magento\Framework\App\Cache\Type\Config'); From 8f8b153dd5a9471f82ced5ea6e2a0dc6776bc6c5 Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Wed, 11 Feb 2015 14:29:48 -0600 Subject: [PATCH 014/106] MAGETWO-33884: Changes to database and module.xml - Fixed integration test. --- .../testsuite/Magento/Framework/Module/DataSetupTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php index 95eaa16633273..a61a8b8dda81d 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php @@ -65,8 +65,8 @@ public function testUpdateTableRow() */ public function testGetTableRow() { - $this->assertNotEmpty($this->_model->getTableRow('setup_module', 'module', 'core_setup')); - $this->_model->getTableRow('setup/module', 'module', 'core_setup'); + $this->assertNotEmpty($this->_model->getTableRow('setup_module', 'module', 'Magento_AdminNotification')); + $this->_model->getTableRow('setup/module', 'module', 'Magento_AdminNotification'); } /** From bb4676b496af97706b65ea276b02389ca53166b3 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 11 Feb 2015 13:57:55 -0600 Subject: [PATCH 015/106] MAGETWO-33887: Create SPI interfaces and context class - implemented data install classes for Customer and GoogleShopping modules - extracted Eav setup logic to a separate class to be extended by other Eav-based setup models --- app/code/Magento/Customer/Setup/Customer.php | 454 ++++++ .../Magento/Customer/Setup/InstallData.php | 165 ++ app/code/Magento/Eav/Setup/Eav.php | 1365 +++++++++++++++++ .../GoogleShopping/Setup/InstallData.php | 81 + .../Magento/Framework/Module/DataSetup.php | 10 +- .../Setup/ModuleDataResourceInterface.php | 9 +- 6 files changed, 2082 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Customer/Setup/Customer.php create mode 100644 app/code/Magento/Customer/Setup/InstallData.php create mode 100644 app/code/Magento/Eav/Setup/Eav.php create mode 100644 app/code/Magento/GoogleShopping/Setup/InstallData.php diff --git a/app/code/Magento/Customer/Setup/Customer.php b/app/code/Magento/Customer/Setup/Customer.php new file mode 100644 index 0000000000000..0694c315e37f3 --- /dev/null +++ b/app/code/Magento/Customer/Setup/Customer.php @@ -0,0 +1,454 @@ +eavConfig = $eavConfig; + parent::__construct($setup, $context, $cache, $attrGroupCollectionFactory); + } + + /** + * Add customer attributes to customer forms + * + * @return void + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function installCustomerForms() + { + $customer = (int)parent::getEntityTypeId('customer'); + $customerAddress = (int)parent::getEntityTypeId('customer_address'); + + $attributeIds = []; + $select = $this->getSetup()->getConnection()->select()->from( + ['ea' => $this->getSetup()->getTable('eav_attribute')], + ['entity_type_id', 'attribute_code', 'attribute_id'] + )->where( + 'ea.entity_type_id IN(?)', + [$customer, $customerAddress] + ); + foreach ($this->getSetup()->getConnection()->fetchAll($select) as $row) { + $attributeIds[$row['entity_type_id']][$row['attribute_code']] = $row['attribute_id']; + } + + $data = []; + $entities = $this->getDefaultEntities(); + $attributes = $entities['customer']['attributes']; + foreach ($attributes as $attributeCode => $attribute) { + $attributeId = $attributeIds[$customer][$attributeCode]; + $attribute['system'] = isset($attribute['system']) ? $attribute['system'] : true; + $attribute['visible'] = isset($attribute['visible']) ? $attribute['visible'] : true; + if ($attribute['system'] != true || $attribute['visible'] != false) { + $usedInForms = ['customer_account_create', 'customer_account_edit', 'checkout_register']; + if (!empty($attribute['adminhtml_only'])) { + $usedInForms = ['adminhtml_customer']; + } else { + $usedInForms[] = 'adminhtml_customer'; + } + if (!empty($attribute['admin_checkout'])) { + $usedInForms[] = 'adminhtml_checkout'; + } + foreach ($usedInForms as $formCode) { + $data[] = ['form_code' => $formCode, 'attribute_id' => $attributeId]; + } + } + } + + $attributes = $entities['customer_address']['attributes']; + foreach ($attributes as $attributeCode => $attribute) { + $attributeId = $attributeIds[$customerAddress][$attributeCode]; + $attribute['system'] = isset($attribute['system']) ? $attribute['system'] : true; + $attribute['visible'] = isset($attribute['visible']) ? $attribute['visible'] : true; + if (false === ($attribute['system'] == true && $attribute['visible'] == false)) { + $usedInForms = [ + 'adminhtml_customer_address', + 'customer_address_edit', + 'customer_register_address', + ]; + foreach ($usedInForms as $formCode) { + $data[] = ['form_code' => $formCode, 'attribute_id' => $attributeId]; + } + } + } + + if ($data) { + $this->getSetup()->getConnection()->insertMultiple($this->getSetup()->getTable('customer_form_attribute'), $data); + } + } + + /** + * Retrieve default entities: customer, customer_address + * + * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function getDefaultEntities() + { + $entities = [ + 'customer' => [ + 'entity_model' => 'Magento\Customer\Model\Resource\Customer', + 'attribute_model' => 'Magento\Customer\Model\Attribute', + 'table' => 'customer_entity', + 'increment_model' => 'Magento\Eav\Model\Entity\Increment\Numeric', + 'additional_attribute_table' => 'customer_eav_attribute', + 'entity_attribute_collection' => 'Magento\Customer\Model\Resource\Attribute\Collection', + 'attributes' => [ + 'website_id' => [ + 'type' => 'static', + 'label' => 'Associate to Website', + 'input' => 'select', + 'source' => 'Magento\Customer\Model\Customer\Attribute\Source\Website', + 'backend' => 'Magento\Customer\Model\Customer\Attribute\Backend\Website', + 'sort_order' => 10, + 'position' => 10, + 'adminhtml_only' => 1, + ], + 'store_id' => [ + 'type' => 'static', + 'label' => 'Create In', + 'input' => 'select', + 'source' => 'Magento\Customer\Model\Customer\Attribute\Source\Store', + 'backend' => 'Magento\Customer\Model\Customer\Attribute\Backend\Store', + 'sort_order' => 20, + 'visible' => false, + 'adminhtml_only' => 1, + ], + 'created_in' => [ + 'type' => 'varchar', + 'label' => 'Created From', + 'input' => 'text', + 'required' => false, + 'sort_order' => 20, + 'position' => 20, + 'adminhtml_only' => 1, + ], + 'prefix' => [ + 'type' => 'varchar', + 'label' => 'Prefix', + 'input' => 'text', + 'required' => false, + 'sort_order' => 30, + 'visible' => false, + 'system' => false, + 'position' => 30, + ], + 'firstname' => [ + 'type' => 'varchar', + 'label' => 'First Name', + 'input' => 'text', + 'sort_order' => 40, + 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', + 'position' => 40, + ], + 'middlename' => [ + 'type' => 'varchar', + 'label' => 'Middle Name/Initial', + 'input' => 'text', + 'required' => false, + 'sort_order' => 50, + 'visible' => false, + 'system' => false, + 'position' => 50, + ], + 'lastname' => [ + 'type' => 'varchar', + 'label' => 'Last Name', + 'input' => 'text', + 'sort_order' => 60, + 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', + 'position' => 60, + ], + 'suffix' => [ + 'type' => 'varchar', + 'label' => 'Suffix', + 'input' => 'text', + 'required' => false, + 'sort_order' => 70, + 'visible' => false, + 'system' => false, + 'position' => 70, + ], + 'email' => [ + 'type' => 'static', + 'label' => 'Email', + 'input' => 'text', + 'sort_order' => 80, + 'validate_rules' => 'a:1:{s:16:"input_validation";s:5:"email";}', + 'position' => 80, + 'admin_checkout' => 1, + ], + 'group_id' => [ + 'type' => 'static', + 'label' => 'Group', + 'input' => 'select', + 'source' => 'Magento\Customer\Model\Customer\Attribute\Source\Group', + 'sort_order' => 25, + 'position' => 25, + 'adminhtml_only' => 1, + 'admin_checkout' => 1, + ], + 'dob' => [ + 'type' => 'datetime', + 'label' => 'Date Of Birth', + 'input' => 'date', + 'frontend' => 'Magento\Eav\Model\Entity\Attribute\Frontend\Datetime', + 'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\Datetime', + 'required' => false, + 'sort_order' => 90, + 'visible' => false, + 'system' => false, + 'input_filter' => 'date', + 'validate_rules' => 'a:1:{s:16:"input_validation";s:4:"date";}', + 'position' => 90, + 'admin_checkout' => 1, + ], + 'password_hash' => [ + 'type' => 'varchar', + 'input' => 'hidden', + 'backend' => 'Magento\Customer\Model\Customer\Attribute\Backend\Password', + 'required' => false, + 'sort_order' => 81, + 'visible' => false, + ], + 'default_billing' => [ + 'type' => 'int', + 'label' => 'Default Billing Address', + 'input' => 'text', + 'backend' => 'Magento\Customer\Model\Customer\Attribute\Backend\Billing', + 'required' => false, + 'sort_order' => 82, + 'visible' => false, + ], + 'default_shipping' => [ + 'type' => 'int', + 'label' => 'Default Shipping Address', + 'input' => 'text', + 'backend' => 'Magento\Customer\Model\Customer\Attribute\Backend\Shipping', + 'required' => false, + 'sort_order' => 83, + 'visible' => false, + ], + 'taxvat' => [ + 'type' => 'varchar', + 'label' => 'Tax/VAT Number', + 'input' => 'text', + 'required' => false, + 'sort_order' => 100, + 'visible' => false, + 'system' => false, + 'validate_rules' => 'a:1:{s:15:"max_text_length";i:255;}', + 'position' => 100, + 'admin_checkout' => 1, + ], + 'confirmation' => [ + 'type' => 'varchar', + 'label' => 'Is Confirmed', + 'input' => 'text', + 'required' => false, + 'sort_order' => 85, + 'visible' => false, + ], + 'created_at' => [ + 'type' => 'static', + 'label' => 'Created At', + 'input' => 'date', + 'required' => false, + 'sort_order' => 86, + 'visible' => false, + 'system' => false, + ], + 'gender' => [ + 'type' => 'int', + 'label' => 'Gender', + 'input' => 'select', + 'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Table', + 'required' => false, + 'sort_order' => 110, + 'visible' => false, + 'system' => false, + 'validate_rules' => 'a:0:{}', + 'position' => 110, + 'admin_checkout' => 1, + 'option' => ['values' => ['Male', 'Female']], + ], + ], + ], + 'customer_address' => [ + 'entity_model' => 'Magento\Customer\Model\Resource\Address', + 'attribute_model' => 'Magento\Customer\Model\Attribute', + 'table' => 'customer_address_entity', + 'additional_attribute_table' => 'customer_eav_attribute', + 'entity_attribute_collection' => 'Magento\Customer\Model\Resource\Address\Attribute\Collection', + 'attributes' => [ + 'prefix' => [ + 'type' => 'varchar', + 'label' => 'Prefix', + 'input' => 'text', + 'required' => false, + 'sort_order' => 10, + 'visible' => false, + 'system' => false, + 'position' => 10, + ], + 'firstname' => [ + 'type' => 'varchar', + 'label' => 'First Name', + 'input' => 'text', + 'sort_order' => 20, + 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', + 'position' => 20, + ], + 'middlename' => [ + 'type' => 'varchar', + 'label' => 'Middle Name/Initial', + 'input' => 'text', + 'required' => false, + 'sort_order' => 30, + 'visible' => false, + 'system' => false, + 'position' => 30, + ], + 'lastname' => [ + 'type' => 'varchar', + 'label' => 'Last Name', + 'input' => 'text', + 'sort_order' => 40, + 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', + 'position' => 40, + ], + 'suffix' => [ + 'type' => 'varchar', + 'label' => 'Suffix', + 'input' => 'text', + 'required' => false, + 'sort_order' => 50, + 'visible' => false, + 'system' => false, + 'position' => 50, + ], + 'company' => [ + 'type' => 'varchar', + 'label' => 'Company', + 'input' => 'text', + 'required' => false, + 'sort_order' => 60, + 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', + 'position' => 60, + ], + 'street' => [ + 'type' => 'text', + 'label' => 'Street Address', + 'input' => 'multiline', + 'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend', + 'sort_order' => 70, + 'multiline_count' => 2, + 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', + 'position' => 70, + ], + 'city' => [ + 'type' => 'varchar', + 'label' => 'City', + 'input' => 'text', + 'sort_order' => 80, + 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', + 'position' => 80, + ], + 'country_id' => [ + 'type' => 'varchar', + 'label' => 'Country', + 'input' => 'select', + 'source' => 'Magento\Customer\Model\Resource\Address\Attribute\Source\Country', + 'sort_order' => 90, + 'position' => 90, + ], + 'region' => [ + 'type' => 'varchar', + 'label' => 'State/Province', + 'input' => 'text', + 'backend' => 'Magento\Customer\Model\Resource\Address\Attribute\Backend\Region', + 'required' => false, + 'sort_order' => 100, + 'position' => 100, + ], + 'region_id' => [ + 'type' => 'int', + 'label' => 'State/Province', + 'input' => 'hidden', + 'source' => 'Magento\Customer\Model\Resource\Address\Attribute\Source\Region', + 'required' => false, + 'sort_order' => 100, + 'position' => 100, + ], + 'postcode' => [ + 'type' => 'varchar', + 'label' => 'Zip/Postal Code', + 'input' => 'text', + 'sort_order' => 110, + 'validate_rules' => 'a:0:{}', + 'data' => 'Magento\Customer\Model\Attribute\Data\Postcode', + 'position' => 110, + 'required' => false, + ], + 'telephone' => [ + 'type' => 'varchar', + 'label' => 'Phone Number', + 'input' => 'text', + 'sort_order' => 120, + 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', + 'position' => 120, + ], + 'fax' => [ + 'type' => 'varchar', + 'label' => 'Fax', + 'input' => 'text', + 'required' => false, + 'sort_order' => 130, + 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', + 'position' => 130, + ], + ], + ], + ]; + return $entities; + } + + /** + * @return Config + */ + public function getEavConfig() + { + return $this->eavConfig; + } +} diff --git a/app/code/Magento/Customer/Setup/InstallData.php b/app/code/Magento/Customer/Setup/InstallData.php new file mode 100644 index 0000000000000..622de68da42a7 --- /dev/null +++ b/app/code/Magento/Customer/Setup/InstallData.php @@ -0,0 +1,165 @@ +customerSetup = $customerSetup; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + $setup->startSetup(); + + // insert default customer groups + $setup->getConnection()->insertForce( + $setup->getTable('customer_group'), + ['customer_group_id' => 0, 'customer_group_code' => 'NOT LOGGED IN', 'tax_class_id' => 3] + ); + $setup->getConnection()->insertForce( + $setup->getTable('customer_group'), + ['customer_group_id' => 1, 'customer_group_code' => 'General', 'tax_class_id' => 3] + ); + $setup->getConnection()->insertForce( + $setup->getTable('customer_group'), + ['customer_group_id' => 2, 'customer_group_code' => 'Wholesale', 'tax_class_id' => 3] + ); + $setup->getConnection()->insertForce( + $setup->getTable('customer_group'), + ['customer_group_id' => 3, 'customer_group_code' => 'Retailer', 'tax_class_id' => 3] + ); + + $this->customerSetup->installEntities(); + + $this->customerSetup->installCustomerForms(); + + // Add reset password link token attribute + $this->customerSetup->addAttribute( + 'customer', + 'rp_token', + ['type' => 'varchar', 'input' => 'hidden', 'visible' => false, 'required' => false] + ); + + // Add reset password link token creation date attribute + $this->customerSetup->addAttribute( + 'customer', + 'rp_token_created_at', + [ + 'type' => 'datetime', + 'input' => 'date', + 'validate_rules' => 'a:1:{s:16:"input_validation";s:4:"date";}', + 'visible' => false, + 'required' => false + ] + ); + + // Add VAT attributes to customer address + $disableAGCAttributeCode = 'disable_auto_group_change'; + + $this->customerSetup->addAttribute( + 'customer', + $disableAGCAttributeCode, + [ + 'type' => 'static', + 'label' => 'Disable Automatic Group Change Based on VAT ID', + 'input' => 'boolean', + 'backend' => 'Magento\Customer\Model\Attribute\Backend\Data\Boolean', + 'position' => 28, + 'required' => false + ] + ); + + $disableAGCAttribute = $this->customerSetup->getEavConfig()->getAttribute('customer', $disableAGCAttributeCode); + $disableAGCAttribute->setData('used_in_forms', ['adminhtml_customer']); + $disableAGCAttribute->save(); + + $attributesInfo = [ + 'vat_id' => [ + 'label' => 'VAT number', + 'type' => 'varchar', + 'input' => 'text', + 'position' => 140, + 'visible' => true, + 'required' => false, + ], + 'vat_is_valid' => [ + 'label' => 'VAT number validity', + 'visible' => false, + 'required' => false, + 'type' => 'int', + ], + 'vat_request_id' => [ + 'label' => 'VAT number validation request ID', + 'type' => 'varchar', + 'visible' => false, + 'required' => false, + ], + 'vat_request_date' => [ + 'label' => 'VAT number validation request date', + 'type' => 'varchar', + 'visible' => false, + 'required' => false, + ], + 'vat_request_success' => [ + 'label' => 'VAT number validation request success', + 'visible' => false, + 'required' => false, + 'type' => 'int', + ], + ]; + + foreach ($attributesInfo as $attributeCode => $attributeParams) { + $this->customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams); + } + + $vatIdAttribute = $this->customerSetup->getEavConfig()->getAttribute('customer_address', 'vat_id'); + $vatIdAttribute->setData( + 'used_in_forms', + ['adminhtml_customer_address', 'customer_address_edit', 'customer_register_address'] + ); + $vatIdAttribute->save(); + + $entities = $this->customerSetup->getDefaultEntities(); + foreach ($entities as $entityName => $entity) { + $this->customerSetup->addEntityType($entityName, $entity); + } + + $this->customerSetup->updateAttribute( + 'customer_address', + 'street', + 'backend_model', + 'Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend' + ); + + $migrationSetup = $setup->createMigrationSetup(); + + $migrationSetup->appendClassAliasReplace( + 'customer_eav_attribute', + 'data_model', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['attribute_id'] + ); + $migrationSetup->doUpdateClassAliases(); + + $migrationSetup->endSetup(); + } +} diff --git a/app/code/Magento/Eav/Setup/Eav.php b/app/code/Magento/Eav/Setup/Eav.php new file mode 100644 index 0000000000000..b2abdebb5cffe --- /dev/null +++ b/app/code/Magento/Eav/Setup/Eav.php @@ -0,0 +1,1365 @@ +cache = $cache; + $this->attrGroupCollectionFactory = $attrGroupCollectionFactory; + $this->attributeMapper = $context->getAttributeMapper(); + $this->setup = $setup; + } + + /** + * General Attribute Group Name + * + * @var string + */ + private $_generalGroupName = 'General'; + + /** + * Default attribute group name to id pairs + * + * @var array + */ + public $defaultGroupIdAssociations = ['General' => 1]; + + /** + * Default attribute group name + * + * @var string + */ + private $_defaultGroupName = 'Default'; + + /** + * Default attribute set name + * + * @var string + */ + private $_defaultAttributeSetName = 'Default'; + + /** + * @return ModuleDataResourceInterface + */ + public function getSetup() + { + return $this->setup; + } + + /** + * @return \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection + */ + public function getAttributeGroupCollectionFactory() + { + return $this->attrGroupCollectionFactory->create(); + } + + /** + * Clean cache + * + * @return $this + */ + public function cleanCache() + { + $this->cache->clean([\Magento\Eav\Model\Cache\Type::CACHE_TAG]); + return $this; + } + + /** + * Install Default Group Ids + * + * @return $this + */ + public function installDefaultGroupIds() + { + $setIds = $this->getAllAttributeSetIds(); + foreach ($this->defaultGroupIdAssociations as $defaultGroupName => $defaultGroupId) { + foreach ($setIds as $set) { + $groupId = $this->setup->getTableRow( + 'eav_attribute_group', + 'attribute_group_name', + $defaultGroupName, + 'attribute_group_id', + 'attribute_set_id', + $set + ); + if (!$groupId) { + $groupId = $this->setup->getTableRow( + 'eav_attribute_group', + 'attribute_set_id', + $set, + 'attribute_group_id' + ); + } + $this->setup->updateTableRow( + 'eav_attribute_group', + 'attribute_group_id', + $groupId, + 'default_id', + $defaultGroupId + ); + } + } + + return $this; + } + + /******************* ENTITY TYPES *****************/ + + /** + * Add an entity type + * + * If already exists updates the entity type with params data + * + * @param string $code + * @param array $params + * @return $this + */ + public function addEntityType($code, array $params) + { + $data = [ + 'entity_type_code' => $code, + 'entity_model' => $params['entity_model'], + 'attribute_model' => $this->_getValue($params, 'attribute_model'), + 'entity_table' => $this->_getValue($params, 'table', 'eav_entity'), + 'value_table_prefix' => $this->_getValue($params, 'table_prefix'), + 'entity_id_field' => $this->_getValue($params, 'id_field'), + 'increment_model' => $this->_getValue($params, 'increment_model'), + 'increment_per_store' => $this->_getValue($params, 'increment_per_store', 0), + 'increment_pad_length' => $this->_getValue($params, 'increment_pad_length', 8), + 'increment_pad_char' => $this->_getValue($params, 'increment_pad_char', 0), + 'additional_attribute_table' => $this->_getValue($params, 'additional_attribute_table'), + 'entity_attribute_collection' => $this->_getValue($params, 'entity_attribute_collection'), + ]; + + if ($this->getEntityType($code, 'entity_type_id')) { + $this->updateEntityType($code, $data); + } else { + $this->setup->getConnection()->insert($this->setup->getTable('eav_entity_type'), $data); + } + + if (!empty($params['default_group'])) { + $defaultGroup = $params['default_group']; + } else { + $defaultGroup = $this->_defaultGroupName; + } + + $this->addAttributeSet($code, $this->_defaultAttributeSetName); + $this->addAttributeGroup($code, $defaultGroup, $this->_generalGroupName); + + return $this; + } + + /** + * Update entity row + * + * @param string $code + * @param string $field + * @param string $value + * @return $this + */ + public function updateEntityType($code, $field, $value = null) + { + $this->setup->updateTableRow('eav_entity_type', 'entity_type_id', $this->getEntityTypeId($code), $field, $value); + return $this; + } + + /** + * Retrieve Entity Type Data + * + * @param int|string $id + * @param string $field + * @return mixed + */ + public function getEntityType($id, $field = null) + { + return $this->setup->getTableRow( + 'eav_entity_type', + is_numeric($id) ? 'entity_type_id' : 'entity_type_code', + $id, + $field + ); + } + + /** + * Retrieve Entity Type Id By Id or Code + * + * @param int|string $entityTypeId + * @return int + * @throws \Magento\Eav\Exception + */ + public function getEntityTypeId($entityTypeId) + { + if (!is_numeric($entityTypeId)) { + $entityTypeId = $this->getEntityType($entityTypeId, 'entity_type_id'); + } + if (!is_numeric($entityTypeId)) { + throw new \Magento\Eav\Exception(__('Wrong entity ID')); + } + + return $entityTypeId; + } + + /** + * Remove entity type by Id or Code + * + * @param int|string $id + * @return $this + */ + public function removeEntityType($id) + { + if (is_numeric($id)) { + $this->setup->deleteTableRow('eav_entity_type', 'entity_type_id', $id); + } else { + $this->setup->deleteTableRow('eav_entity_type', 'entity_type_code', (string)$id); + } + + return $this; + } + + /******************* ATTRIBUTE SETS *****************/ + + /** + * Retrieve Attribute Set Sort order + * + * @param int|string $entityTypeId + * @param int $sortOrder + * @return int + */ + public function getAttributeSetSortOrder($entityTypeId, $sortOrder = null) + { + if (!is_numeric($sortOrder)) { + $bind = ['entity_type_id' => $this->getEntityTypeId($entityTypeId)]; + $select = $this->setup->getConnection()->select()->from( + $this->setup->getTable('eav_attribute_set'), + 'MAX(sort_order)' + )->where( + 'entity_type_id = :entity_type_id' + ); + + $sortOrder = $this->setup->getConnection()->fetchOne($select, $bind) + 1; + } + + return $sortOrder; + } + + /** + * Add Attribute Set + * + * @param int|string $entityTypeId + * @param string $name + * @param int $sortOrder + * @return $this + */ + public function addAttributeSet($entityTypeId, $name, $sortOrder = null) + { + $data = [ + 'entity_type_id' => $this->getEntityTypeId($entityTypeId), + 'attribute_set_name' => $name, + 'sort_order' => $this->getAttributeSetSortOrder($entityTypeId, $sortOrder), + ]; + + $setId = $this->getAttributeSet($entityTypeId, $name, 'attribute_set_id'); + if ($setId) { + $this->updateAttributeSet($entityTypeId, $setId, $data); + } else { + $this->setup->getConnection()->insert($this->setup->getTable('eav_attribute_set'), $data); + + $this->addAttributeGroup($entityTypeId, $name, $this->_generalGroupName); + } + + return $this; + } + + /** + * Update attribute set data + * + * @param int|string $entityTypeId + * @param int $id + * @param string $field + * @param mixed $value + * @return $this + */ + public function updateAttributeSet($entityTypeId, $id, $field, $value = null) + { + $this->setup->updateTableRow( + 'eav_attribute_set', + 'attribute_set_id', + $this->getAttributeSetId($entityTypeId, $id), + $field, + $value, + 'entity_type_id', + $this->getEntityTypeId($entityTypeId) + ); + return $this; + } + + /** + * Retrieve Attribute set data by id or name + * + * @param int|string $entityTypeId + * @param int|string $id + * @param string $field + * @return mixed + */ + public function getAttributeSet($entityTypeId, $id, $field = null) + { + return $this->setup->getTableRow( + 'eav_attribute_set', + is_numeric($id) ? 'attribute_set_id' : 'attribute_set_name', + $id, + $field, + 'entity_type_id', + $this->getEntityTypeId($entityTypeId) + ); + } + + /** + * Retrieve Attribute Set Id By Id or Name + * + * @param int|string $entityTypeId + * @param int|string $setId + * @return int + * @throws \Magento\Eav\Exception + */ + public function getAttributeSetId($entityTypeId, $setId) + { + if (!is_numeric($setId)) { + $setId = $this->getAttributeSet($entityTypeId, $setId, 'attribute_set_id'); + } + if (!is_numeric($setId)) { + throw new \Magento\Eav\Exception(__('Wrong attribute set ID')); + } + + return $setId; + } + + /** + * Remove Attribute Set + * + * @param int|string $entityTypeId + * @param int|string $id + * @return $this + */ + public function removeAttributeSet($entityTypeId, $id) + { + $this->setup->deleteTableRow('eav_attribute_set', 'attribute_set_id', $this->getAttributeSetId($entityTypeId, $id)); + return $this; + } + + /** + * Set Default Attribute Set to Entity Type + * + * @param int|string $entityType + * @param string $attributeSet + * @return $this + */ + public function setDefaultSetToEntityType($entityType, $attributeSet = 'Default') + { + $entityTypeId = $this->getEntityTypeId($entityType); + $setId = $this->getAttributeSetId($entityTypeId, $attributeSet); + $this->updateEntityType($entityTypeId, 'default_attribute_set_id', $setId); + return $this; + } + + /** + * Get identifiers of all attribute sets + * + * @param int|string|null $entityTypeId + * @return array + */ + public function getAllAttributeSetIds($entityTypeId = null) + { + $select = $this->setup->getConnection()->select()->from($this->setup->getTable('eav_attribute_set'), 'attribute_set_id'); + + $bind = []; + if ($entityTypeId !== null) { + $bind['entity_type_id'] = $this->getEntityTypeId($entityTypeId); + $select->where('entity_type_id = :entity_type_id'); + } + + return $this->setup->getConnection()->fetchCol($select, $bind); + } + + /** + * Retrieve Default Attribute Set for Entity Type + * + * @param string|int $entityType + * @return int + */ + public function getDefaultAttributeSetId($entityType) + { + $bind = ['entity_type' => $entityType]; + if (is_numeric($entityType)) { + $where = 'entity_type_id = :entity_type'; + } else { + $where = 'entity_type_code = :entity_type'; + } + $select = $this->setup->getConnection()->select()->from( + $this->setup->getTable('eav_entity_type'), + 'default_attribute_set_id' + )->where( + $where + ); + + return $this->setup->getConnection()->fetchOne($select, $bind); + } + + /******************* ATTRIBUTE GROUPS *****************/ + + /** + * Retrieve Attribute Group Sort order + * + * @param int|string $entityTypeId + * @param int|string $setId + * @param int $sortOrder + * @return int + */ + public function getAttributeGroupSortOrder($entityTypeId, $setId, $sortOrder = null) + { + if (!is_numeric($sortOrder)) { + $bind = ['attribute_set_id' => $this->getAttributeSetId($entityTypeId, $setId)]; + $select = $this->setup->getConnection()->select()->from( + $this->setup->getTable('eav_attribute_group'), + 'MAX(sort_order)' + )->where( + 'attribute_set_id = :attribute_set_id' + ); + + $sortOrder = $this->setup->getConnection()->fetchOne($select, $bind) + 1; + } + + return $sortOrder; + } + + /** + * Add Attribute Group + * + * @param int|string $entityTypeId + * @param int|string $setId + * @param string $name + * @param int $sortOrder + * @return $this + */ + public function addAttributeGroup($entityTypeId, $setId, $name, $sortOrder = null) + { + $setId = $this->getAttributeSetId($entityTypeId, $setId); + $data = ['attribute_set_id' => $setId, 'attribute_group_name' => $name]; + + if (isset($this->defaultGroupIdAssociations[$name])) { + $data['default_id'] = $this->defaultGroupIdAssociations[$name]; + } + + if ($sortOrder !== null) { + $data['sort_order'] = $sortOrder; + } + + $groupId = $this->getAttributeGroup($entityTypeId, $setId, $name, 'attribute_group_id'); + if ($groupId) { + $this->updateAttributeGroup($entityTypeId, $setId, $groupId, $data); + } else { + if ($sortOrder === null) { + $data['sort_order'] = $this->getAttributeGroupSortOrder($entityTypeId, $setId, $sortOrder); + } + $this->setup->getConnection()->insert($this->setup->getTable('eav_attribute_group'), $data); + } + + return $this; + } + + /** + * Update Attribute Group Data + * + * @param int|string $entityTypeId + * @param int|string $setId + * @param int|string $id + * @param string $field + * @param mixed $value + * @return $this + */ + public function updateAttributeGroup($entityTypeId, $setId, $id, $field, $value = null) + { + $this->setup->updateTableRow( + 'eav_attribute_group', + 'attribute_group_id', + $this->getAttributeGroupId($entityTypeId, $setId, $id), + $field, + $value, + 'attribute_set_id', + $this->getAttributeSetId($entityTypeId, $setId) + ); + + return $this; + } + + /** + * Retrieve Attribute Group Data + * + * @param int|string $entityTypeId + * @param int|string $setId + * @param int|string $id + * @param string $field + * @return mixed + */ + public function getAttributeGroup($entityTypeId, $setId, $id, $field = null) + { + $searchId = $id; + if (is_numeric($id)) { + $searchField = 'attribute_group_id'; + } else { + if (isset($this->defaultGroupIdAssociations[$id])) { + $searchField = 'default_id'; + $searchId = $this->defaultGroupIdAssociations[$id]; + } else { + $searchField = 'attribute_group_name'; + } + } + + return $this->setup->getTableRow( + 'eav_attribute_group', + $searchField, + $searchId, + $field, + 'attribute_set_id', + $this->getAttributeSetId($entityTypeId, $setId) + ); + } + + /** + * Retrieve Attribute Group Id by Id or Name + * + * @param int|string $entityTypeId + * @param int|string $setId + * @param int|string $groupId + * @return $this + * @throws \Magento\Eav\Exception + */ + public function getAttributeGroupId($entityTypeId, $setId, $groupId) + { + if (!is_numeric($groupId)) { + $groupId = $this->getAttributeGroup($entityTypeId, $setId, $groupId, 'attribute_group_id'); + } + + if (!is_numeric($groupId)) { + $groupId = $this->getDefaultAttributeGroupId($entityTypeId, $setId); + } + + if (!is_numeric($groupId)) { + throw new \Magento\Eav\Exception(__('Wrong attribute group ID')); + } + return $groupId; + } + + /** + * Remove Attribute Group By Id or Name + * + * @param int|string $entityTypeId + * @param int|string $setId + * @param int|string $id + * @return $this + */ + public function removeAttributeGroup($entityTypeId, $setId, $id) + { + $this->setup->deleteTableRow( + 'eav_attribute_group', + 'attribute_group_id', + $this->getAttributeGroupId($entityTypeId, $setId, $id) + ); + return $this; + } + + /** + * Retrieve Default Attribute Group Id By Entity Type and Attribute Set + * + * @param string|int $entityType + * @param int $attributeSetId + * @return int + */ + public function getDefaultAttributeGroupId($entityType, $attributeSetId = null) + { + $entityType = $this->getEntityTypeId($entityType); + if (!is_numeric($attributeSetId)) { + $attributeSetId = $this->getDefaultAttributeSetId($entityType); + } + $bind = ['attribute_set_id' => $attributeSetId]; + $select = $this->setup->getConnection()->select()->from( + $this->setup->getTable('eav_attribute_group'), + 'attribute_group_id' + )->where( + 'attribute_set_id = :attribute_set_id' + )->order( + ['default_id ' . \Magento\Framework\DB\Select::SQL_DESC, 'sort_order'] + )->limit( + 1 + ); + + return $this->setup->getConnection()->fetchOne($select, $bind); + } + + /** + * Get number of all attributes in group + * + * @param int|string $entityTypeId + * @param int|string $setId + * @param int|string $groupId + * + * @return string + */ + public function getAttributesNumberInGroup($entityTypeId, $setId, $groupId) + { + $select = $this->setup->getConnection()->select()->from( + $this->setup->getTable('eav_entity_attribute'), + ['count' => 'COUNT(*)'] + )->where( + 'attribute_group_id = ?', + $this->getAttributeGroupId($entityTypeId, $setId, $groupId) + )->where( + 'entity_type_id = ?', + $entityTypeId + )->where( + 'attribute_set_id = ?', + $setId + ); + + return $this->setup->getConnection()->fetchOne($select); + } + + /******************* ATTRIBUTES *****************/ + + /** + * Retrieve value from array by key or return default value + * + * @param array $array + * @param string $key + * @param string $default + * @return string + */ + private function _getValue($array, $key, $default = null) + { + if (isset($array[$key]) && is_bool($array[$key])) { + $array[$key] = (int)$array[$key]; + } + return isset($array[$key]) ? $array[$key] : $default; + } + + /** + * Validate attribute data before insert into table + * + * @param array $data + * @return true + * @throws \Magento\Eav\Exception + */ + private function _validateAttributeData($data) + { + $attributeCodeMaxLength = \Magento\Eav\Model\Entity\Attribute::ATTRIBUTE_CODE_MAX_LENGTH; + + if (isset( + $data['attribute_code'] + ) && !\Zend_Validate::is( + $data['attribute_code'], + 'StringLength', + ['max' => $attributeCodeMaxLength] + ) + ) { + throw new \Magento\Eav\Exception( + __('Maximum length of attribute code must be less than %1 symbols', $attributeCodeMaxLength) + ); + } + + return true; + } + + /** + * Add attribute to an entity type + * + * If attribute is system will add to all existing attribute sets + * + * @param string|integer $entityTypeId + * @param string $code + * @param array $attr + * @return $this + */ + public function addAttribute($entityTypeId, $code, array $attr) + { + $entityTypeId = $this->getEntityTypeId($entityTypeId); + + $data = array_replace( + ['entity_type_id' => $entityTypeId, 'attribute_code' => $code], + $this->attributeMapper->map($attr, $entityTypeId) + ); + + $this->_validateAttributeData($data); + + $sortOrder = isset($attr['sort_order']) ? $attr['sort_order'] : null; + $attributeId = $this->getAttribute($entityTypeId, $code, 'attribute_id'); + if ($attributeId) { + $this->updateAttribute($entityTypeId, $attributeId, $data, null, $sortOrder); + } else { + $this->_insertAttribute($data); + } + + if (!empty($attr['group']) || empty($attr['user_defined'])) { + $select = $this->setup->getConnection()->select()->from( + $this->setup->getTable('eav_attribute_set') + )->where( + 'entity_type_id = :entity_type_id' + ); + $sets = $this->setup->getConnection()->fetchAll($select, ['entity_type_id' => $entityTypeId]); + foreach ($sets as $set) { + if (!empty($attr['group'])) { + $this->addAttributeGroup($entityTypeId, $set['attribute_set_id'], $attr['group']); + $this->addAttributeToSet( + $entityTypeId, + $set['attribute_set_id'], + $attr['group'], + $code, + $sortOrder + ); + } else { + $this->addAttributeToSet( + $entityTypeId, + $set['attribute_set_id'], + $this->_generalGroupName, + $code, + $sortOrder + ); + } + } + } + + if (isset($attr['option']) && is_array($attr['option'])) { + $option = $attr['option']; + $option['attribute_id'] = $this->getAttributeId($entityTypeId, $code); + $this->addAttributeOption($option); + } + + return $this; + } + + /** + * Add Attribure Option + * + * @param array $option + * @return void + * @throws \Magento\Framework\Model\Exception + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + */ + public function addAttributeOption($option) + { + $optionTable = $this->setup->getTable('eav_attribute_option'); + $optionValueTable = $this->setup->getTable('eav_attribute_option_value'); + + if (isset($option['value'])) { + foreach ($option['value'] as $optionId => $values) { + $intOptionId = (int)$optionId; + if (!empty($option['delete'][$optionId])) { + if ($intOptionId) { + $condition = ['option_id =?' => $intOptionId]; + $this->setup->getConnection()->delete($optionTable, $condition); + } + continue; + } + + if (!$intOptionId) { + $data = [ + 'attribute_id' => $option['attribute_id'], + 'sort_order' => isset($option['order'][$optionId]) ? $option['order'][$optionId] : 0, + ]; + $this->setup->getConnection()->insert($optionTable, $data); + $intOptionId = $this->setup->getConnection()->lastInsertId($optionTable); + } else { + $data = [ + 'sort_order' => isset($option['order'][$optionId]) ? $option['order'][$optionId] : 0, + ]; + $this->setup->getConnection()->update($optionTable, $data, ['option_id=?' => $intOptionId]); + } + + // Default value + if (!isset($values[0])) { + throw new \Magento\Framework\Model\Exception(__('Default option value is not defined')); + } + $condition = ['option_id =?' => $intOptionId]; + $this->setup->getConnection()->delete($optionValueTable, $condition); + foreach ($values as $storeId => $value) { + $data = ['option_id' => $intOptionId, 'store_id' => $storeId, 'value' => $value]; + $this->setup->getConnection()->insert($optionValueTable, $data); + } + } + } elseif (isset($option['values'])) { + foreach ($option['values'] as $sortOrder => $label) { + // add option + $data = ['attribute_id' => $option['attribute_id'], 'sort_order' => $sortOrder]; + $this->setup->getConnection()->insert($optionTable, $data); + $intOptionId = $this->setup->getConnection()->lastInsertId($optionTable); + + $data = ['option_id' => $intOptionId, 'store_id' => 0, 'value' => $label]; + $this->setup->getConnection()->insert($optionValueTable, $data); + } + } + } + + /** + * Update Attribute data and Attribute additional data + * + * @param int|string $entityTypeId + * @param int|string $id + * @param string $field + * @param mixed $value + * @param int $sortOrder + * @return $this + */ + public function updateAttribute($entityTypeId, $id, $field, $value = null, $sortOrder = null) + { + $this->_updateAttribute($entityTypeId, $id, $field, $value, $sortOrder); + $this->_updateAttributeAdditionalData($entityTypeId, $id, $field, $value); + return $this; + } + + /** + * Update Attribute data + * + * @param int|string $entityTypeId + * @param int|string $id + * @param string $field + * @param mixed $value + * @param int $sortOrder + * @return $this + */ + private function _updateAttribute($entityTypeId, $id, $field, $value = null, $sortOrder = null) + { + if ($sortOrder !== null) { + $this->setup->updateTableRow( + 'eav_entity_attribute', + 'attribute_id', + $this->getAttributeId($entityTypeId, $id), + 'sort_order', + $sortOrder + ); + } + + $attributeFields = $this->_getAttributeTableFields(); + if (is_array($field)) { + $bind = []; + foreach ($field as $k => $v) { + if (isset($attributeFields[$k])) { + $bind[$k] = $this->setup->getConnection()->prepareColumnValue($attributeFields[$k], $v); + } + } + if (!$bind) { + return $this; + } + $field = $bind; + } else { + if (!isset($attributeFields[$field])) { + return $this; + } + } + + $this->setup->updateTableRow( + 'eav_attribute', + 'attribute_id', + $this->getAttributeId($entityTypeId, $id), + $field, + $value, + 'entity_type_id', + $this->getEntityTypeId($entityTypeId) + ); + + return $this; + } + + /** + * Update Attribute Additional data + * + * @param int|string $entityTypeId + * @param int|string $id + * @param string $field + * @param mixed $value + * @return $this + */ + private function _updateAttributeAdditionalData($entityTypeId, $id, $field, $value = null) + { + $additionalTable = $this->getEntityType($entityTypeId, 'additional_attribute_table'); + if (!$additionalTable) { + return $this; + } + $additionalTableExists = $this->setup->getConnection()->isTableExists($this->setup->getTable($additionalTable)); + if ($additionalTable && $additionalTableExists) { + $attributeFields = $this->setup->getConnection()->describeTable($this->setup->getTable($additionalTable)); + if (is_array($field)) { + $bind = []; + foreach ($field as $k => $v) { + if (isset($attributeFields[$k])) { + $bind[$k] = $this->setup->getConnection()->prepareColumnValue($attributeFields[$k], $v); + } + } + if (!$bind) { + return $this; + } + $field = $bind; + } else { + if (!isset($attributeFields[$field])) { + return $this; + } + } + $this->setup->updateTableRow( + $this->setup->getTable($additionalTable), + 'attribute_id', + $this->getAttributeId($entityTypeId, $id), + $field, + $value + ); + } + + return $this; + } + + /** + * Retrieve Attribute Data By Id or Code + * + * @param int|string $entityTypeId + * @param int|string $id + * @param string $field + * @return mixed + */ + public function getAttribute($entityTypeId, $id, $field = null) + { + $additionalTable = $this->getEntityType($entityTypeId, 'additional_attribute_table'); + $entityTypeId = $this->getEntityTypeId($entityTypeId); + $idField = is_numeric($id) ? 'attribute_id' : 'attribute_code'; + if (!$additionalTable) { + return $this->setup->getTableRow('eav_attribute', $idField, $id, $field, 'entity_type_id', $entityTypeId); + } + + $mainTable = $this->setup->getTable('eav_attribute'); + if (empty($this->setup->getSetupCache()[$mainTable][$entityTypeId][$id])) { + $additionalTable = $this->setup->getTable($additionalTable); + $bind = ['id' => $id, 'entity_type_id' => $entityTypeId]; + $select = $this->setup->getConnection()->select()->from( + ['main' => $mainTable] + )->join( + ['additional' => $additionalTable], + 'main.attribute_id = additional.attribute_id' + )->where( + "main.{$idField} = :id" + )->where( + 'main.entity_type_id = :entity_type_id' + ); + + $row = $this->setup->getConnection()->fetchRow($select, $bind); + if (!$row) { + $this->setup->getSetupCache()[$mainTable][$entityTypeId][$id] = false; + } else { + $this->setup->getSetupCache()[$mainTable][$entityTypeId][$row['attribute_id']] = $row; + $this->setup->getSetupCache()[$mainTable][$entityTypeId][$row['attribute_code']] = $row; + } + } + + $row = $this->setup->getSetupCache()[$mainTable][$entityTypeId][$id]; + if ($field !== null) { + return isset($row[$field]) ? $row[$field] : false; + } + + return $row; + } + + /** + * Retrieve Attribute Id Data By Id or Code + * + * @param int|string $entityTypeId + * @param int|string $id + * @return int + */ + public function getAttributeId($entityTypeId, $id) + { + if (!is_numeric($id)) { + $id = $this->getAttribute($entityTypeId, $id, 'attribute_id'); + } + if (!is_numeric($id)) { + return false; + } + return $id; + } + + /** + * Return table name for eav attribute + * + * @param int|string $entityTypeId Entity Type id or Entity Type code + * @param int|string $id Attribute id or Attribute code + * @return string + */ + public function getAttributeTable($entityTypeId, $id) + { + $entityKeyName = is_numeric($entityTypeId) ? 'entity_type_id' : 'entity_type_code'; + $attributeKeyName = is_numeric($id) ? 'attribute_id' : 'attribute_code'; + + $bind = ['id' => $id, 'entity_type_id' => $entityTypeId]; + $select = $this->setup->getConnection()->select()->from( + ['entity_type' => $this->setup->getTable('eav_entity_type')], + ['entity_table'] + )->join( + ['attribute' => $this->setup->getTable('eav_attribute')], + 'attribute.entity_type_id = entity_type.entity_type_id', + ['backend_type'] + )->where( + "entity_type.{$entityKeyName} = :entity_type_id" + )->where( + "attribute.{$attributeKeyName} = :id" + )->limit( + 1 + ); + + $result = $this->setup->getConnection()->fetchRow($select, $bind); + if ($result) { + $table = $this->setup->getTable($result['entity_table']); + if ($result['backend_type'] != 'static') { + $table .= '_' . $result['backend_type']; + } + return $table; + } + + return false; + } + + /** + * Remove Attribute + * + * @param int|string $entityTypeId + * @param int|string $code + * @return $this + */ + public function removeAttribute($entityTypeId, $code) + { + $mainTable = $this->setup->getTable('eav_attribute'); + $attribute = $this->getAttribute($entityTypeId, $code); + if ($attribute) { + $this->setup->deleteTableRow('eav_attribute', 'attribute_id', $attribute['attribute_id']); + if (isset($this->setup->getSetupCache()[$mainTable][$attribute['entity_type_id']][$attribute['attribute_code']])) { + unset($this->setup->getSetupCache()[$mainTable][$attribute['entity_type_id']][$attribute['attribute_code']]); + } + } + return $this; + } + + /** + * Retrieve Attribute Sort Order + * + * @param int|string $entityTypeId + * @param int|string $setId + * @param int|string $groupId + * @param int $sortOrder + * @return $this + */ + public function getAttributeSortOrder($entityTypeId, $setId, $groupId, $sortOrder = null) + { + if (!is_numeric($sortOrder)) { + $bind = ['attribute_group_id' => $this->getAttributeGroupId($entityTypeId, $setId, $groupId)]; + $select = $this->setup->getConnection()->select()->from( + $this->setup->getTable('eav_entity_attribute'), + 'MAX(sort_order)' + )->where( + 'attribute_group_id = :attribute_group_id' + ); + + $sortOrder = $this->setup->getConnection()->fetchOne($select, $bind) + 1; + } + + return $sortOrder; + } + + /** + * Add Attribute to All Groups on Attribute Set + * + * @param int|string $entityTypeId + * @param int|string $setId + * @param int|string $groupId + * @param int|string $attributeId + * @param int $sortOrder + * @return $this + */ + public function addAttributeToSet($entityTypeId, $setId, $groupId, $attributeId, $sortOrder = null) + { + $entityTypeId = $this->getEntityTypeId($entityTypeId); + $setId = $this->getAttributeSetId($entityTypeId, $setId); + $groupId = $this->getAttributeGroupId($entityTypeId, $setId, $groupId); + $attributeId = $this->getAttributeId($entityTypeId, $attributeId); + $table = $this->setup->getTable('eav_entity_attribute'); + + $bind = ['attribute_set_id' => $setId, 'attribute_id' => $attributeId]; + $select = $this->setup->getConnection()->select()->from( + $table + )->where( + 'attribute_set_id = :attribute_set_id' + )->where( + 'attribute_id = :attribute_id' + ); + $result = $this->setup->getConnection()->fetchRow($select, $bind); + + if ($result) { + if ($result['attribute_group_id'] != $groupId) { + $where = ['entity_attribute_id =?' => $result['entity_attribute_id']]; + $data = ['attribute_group_id' => $groupId]; + $this->setup->getConnection()->update($table, $data, $where); + } + } else { + $data = [ + 'entity_type_id' => $entityTypeId, + 'attribute_set_id' => $setId, + 'attribute_group_id' => $groupId, + 'attribute_id' => $attributeId, + 'sort_order' => $this->getAttributeSortOrder($entityTypeId, $setId, $groupId, $sortOrder), + ]; + + $this->setup->getConnection()->insert($table, $data); + } + + return $this; + } + + /** + * Add or update attribute to group + * + * @param int|string $entityType + * @param int|string $setId + * @param int|string $groupId + * @param int|string $attributeId + * @param int $sortOrder + * @return $this + */ + public function addAttributeToGroup($entityType, $setId, $groupId, $attributeId, $sortOrder = null) + { + $entityType = $this->getEntityTypeId($entityType); + $setId = $this->getAttributeSetId($entityType, $setId); + $groupId = $this->getAttributeGroupId($entityType, $setId, $groupId); + $attributeId = $this->getAttributeId($entityType, $attributeId); + + $data = [ + 'entity_type_id' => $entityType, + 'attribute_set_id' => $setId, + 'attribute_group_id' => $groupId, + 'attribute_id' => $attributeId, + ]; + + $bind = ['entity_type_id' => $entityType, 'attribute_set_id' => $setId, 'attribute_id' => $attributeId]; + $select = $this->setup->getConnection()->select()->from( + $this->setup->getTable('eav_entity_attribute') + )->where( + 'entity_type_id = :entity_type_id' + )->where( + 'attribute_set_id = :attribute_set_id' + )->where( + 'attribute_id = :attribute_id' + ); + $row = $this->setup->getConnection()->fetchRow($select, $bind); + if ($row) { + // update + if ($sortOrder !== null) { + $data['sort_order'] = $sortOrder; + } + + $this->setup->getConnection()->update( + $this->setup->getTable('eav_entity_attribute'), + $data, + $this->setup->getConnection()->quoteInto('entity_attribute_id=?', $row['entity_attribute_id']) + ); + } else { + if ($sortOrder === null) { + $select = $this->setup->getConnection()->select()->from( + $this->setup->getTable('eav_entity_attribute'), + 'MAX(sort_order)' + )->where( + 'entity_type_id = :entity_type_id' + )->where( + 'attribute_set_id = :attribute_set_id' + )->where( + 'attribute_id = :attribute_id' + ); + + $sortOrder = $this->setup->getConnection()->fetchOne($select, $bind) + 10; + } + $sortOrder = is_numeric($sortOrder) ? $sortOrder : 1; + $data['sort_order'] = $sortOrder; + $this->setup->getConnection()->insert($this->setup->getTable('eav_entity_attribute'), $data); + } + + return $this; + } + + /******************* BULK INSTALL *****************/ + + /** + * Install entities + * + * @param array $entities + * @return $this + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function installEntities($entities = null) + { + $this->cleanCache(); + + if ($entities === null) { + $entities = $this->getDefaultEntities(); + } + + foreach ($entities as $entityName => $entity) { + $this->addEntityType($entityName, $entity); + + $frontendPrefix = isset($entity['frontend_prefix']) ? $entity['frontend_prefix'] : ''; + $backendPrefix = isset($entity['backend_prefix']) ? $entity['backend_prefix'] : ''; + $sourcePrefix = isset($entity['source_prefix']) ? $entity['source_prefix'] : ''; + + if (is_array($entity['attributes']) && !empty($entity['attributes'])) { + foreach ($entity['attributes'] as $attrCode => $attr) { + if (!empty($attr['backend'])) { + if ('_' === $attr['backend']) { + $attr['backend'] = $backendPrefix; + } elseif ('_' === $attr['backend'][0]) { + $attr['backend'] = $backendPrefix . $attr['backend']; + } else { + $attr['backend'] = $attr['backend']; + } + } + if (!empty($attr['frontend'])) { + if ('_' === $attr['frontend']) { + $attr['frontend'] = $frontendPrefix; + } elseif ('_' === $attr['frontend'][0]) { + $attr['frontend'] = $frontendPrefix . $attr['frontend']; + } else { + $attr['frontend'] = $attr['frontend']; + } + } + if (!empty($attr['source'])) { + if ('_' === $attr['source']) { + $attr['source'] = $sourcePrefix; + } elseif ('_' === $attr['source'][0]) { + $attr['source'] = $sourcePrefix . $attr['source']; + } else { + $attr['source'] = $attr['source']; + } + } + + $this->addAttribute($entityName, $attrCode, $attr); + } + } + $this->setDefaultSetToEntityType($entityName); + } + + return $this; + } + + /** + * Retrieve attribute table fields + * + * @return array + */ + private function _getAttributeTableFields() + { + return $this->setup->getConnection()->describeTable($this->setup->getTable('eav_attribute')); + } + + /** + * Insert attribute and filter data + * + * @param array $data + * @return $this + */ + private function _insertAttribute(array $data) + { + $bind = []; + + $fields = $this->_getAttributeTableFields(); + + foreach ($data as $k => $v) { + if (isset($fields[$k])) { + $bind[$k] = $this->setup->getConnection()->prepareColumnValue($fields[$k], $v); + } + } + if (!$bind) { + return $this; + } + + $this->setup->getConnection()->insert($this->setup->getTable('eav_attribute'), $bind); + $attributeId = $this->setup->getConnection()->lastInsertId($this->setup->getTable('eav_attribute')); + $this->_insertAttributeAdditionalData( + $data['entity_type_id'], + array_merge(['attribute_id' => $attributeId], $data) + ); + + return $this; + } + + /** + * Insert attribute additional data + * + * @param int|string $entityTypeId + * @param array $data + * @return $this + */ + private function _insertAttributeAdditionalData($entityTypeId, array $data) + { + $additionalTable = $this->getEntityType($entityTypeId, 'additional_attribute_table'); + if (!$additionalTable) { + return $this; + } + $additionalTableExists = $this->setup->getConnection()->isTableExists($this->setup->getTable($additionalTable)); + if ($additionalTable && $additionalTableExists) { + $bind = []; + $fields = $this->setup->getConnection()->describeTable($this->setup->getTable($additionalTable)); + foreach ($data as $k => $v) { + if (isset($fields[$k])) { + $bind[$k] = $this->setup->getConnection()->prepareColumnValue($fields[$k], $v); + } + } + if (!$bind) { + return $this; + } + $this->setup->getConnection()->insert($this->setup->getTable($additionalTable), $bind); + } + + return $this; + } +} diff --git a/app/code/Magento/GoogleShopping/Setup/InstallData.php b/app/code/Magento/GoogleShopping/Setup/InstallData.php new file mode 100644 index 0000000000000..e176f8d3a9ad4 --- /dev/null +++ b/app/code/Magento/GoogleShopping/Setup/InstallData.php @@ -0,0 +1,81 @@ +configFactory = $configFactory; + $this->moduleManager = $moduleManager; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + if ($this->moduleManager->isEnabled('Magento_GoogleBase')) { + $typesInsert = $setup->getConnection()->select()->from( + $setup->getTable('googlebase_types'), + ['type_id', 'attribute_set_id', 'target_country', 'category' => new \Zend_Db_Expr('NULL')] + )->insertFromSelect( + $setup->getTable('googleshopping_types') + ); + + $itemsInsert = $setup->getConnection()->select()->from( + $setup->getTable('googlebase_items'), + ['item_id', 'type_id', 'product_id', 'gbase_item_id', 'store_id', 'published', 'expires'] + )->insertFromSelect( + $setup->getTable('googleshopping_items') + ); + + $attributes = ''; + foreach ($this->configFactory->create()->getAttributes() as $destAttribtues) { + foreach ($destAttribtues as $code => $info) { + $attributes .= "'{$code}',"; + } + } + $attributes = rtrim($attributes, ','); + $attributesInsert = $setup->getConnection()->select()->from( + $setup->getTable('googlebase_attributes'), + [ + 'id', + 'attribute_id', + 'gbase_attribute' => new \Zend_Db_Expr("IF(gbase_attribute IN ({$attributes}), gbase_attribute, '')"), + 'type_id' + ] + )->insertFromSelect( + $setup->getTable('googleshopping_attributes') + ); + + $setup->run($typesInsert); + $setup->run($attributesInsert); + $setup->run($itemsInsert); + } + } +} diff --git a/lib/internal/Magento/Framework/Module/DataSetup.php b/lib/internal/Magento/Framework/Module/DataSetup.php index f6a97a6d0a944..9246205c4734e 100644 --- a/lib/internal/Magento/Framework/Module/DataSetup.php +++ b/lib/internal/Magento/Framework/Module/DataSetup.php @@ -22,7 +22,7 @@ class DataSetup extends \Magento\Framework\Module\Setup implements ModuleDataRes * Setup module name * @var string */ - protected $moduleName; + private $moduleName; /** * Setup module configuration object @@ -322,6 +322,14 @@ private function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrF /******************* UTILITY METHODS *****************/ + /** + * {@inheritdoc} + */ + public function getSetupCache() + { + return $this->_setupCache; + } + /** * Retrieve row or field from table by id or string and parent id * diff --git a/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php b/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php index 907ba4d1d11e6..945ce85589c1c 100644 --- a/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php +++ b/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php @@ -102,4 +102,11 @@ public function getFilesystem(); * @return \Magento\Framework\Module\Setup\Migration */ public function createMigrationSetup(array $data = []); -} \ No newline at end of file + + /** + * Gets setup cache + * + * @return array + */ + public function getSetupCache(); +} From 997631fddf288bd2bbdf6a2cf0ccbb8e1e0b2995 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 11 Feb 2015 14:26:39 -0600 Subject: [PATCH 016/106] MAGETWO-33887: Create SPI interfaces and context class - moved DataSetup model to Setup application --- .../Authorization/Model/Resource/Setup.php | 2 +- app/code/Magento/CheckoutAgreements/etc/di.xml | 7 ------- app/code/Magento/Cms/Model/Resource/Setup.php | 2 +- app/code/Magento/Core/etc/di.xml | 15 +-------------- app/code/Magento/Dhl/Model/Resource/Setup.php | 2 +- .../Magento/Directory/Model/Resource/Setup.php | 2 +- app/code/Magento/Eav/Model/Entity/Setup.php | 2 +- .../Magento/GiftMessage/Model/Resource/Setup.php | 2 +- .../GoogleShopping/Model/Resource/Setup.php | 2 +- .../Magento/Integration/Model/Resource/Setup.php | 2 +- app/code/Magento/Reports/Model/Resource/Setup.php | 2 +- app/code/Magento/Store/etc/di.xml | 7 ------- app/code/Magento/Theme/Model/Resource/Setup.php | 2 +- app/code/Magento/User/etc/di.xml | 7 ------- app/code/Magento/Weee/Model/Resource/Setup.php | 2 +- .../{Framework => Setup}/Module/DataSetupTest.php | 2 +- .../Magento/Framework/Module/Setup/Migration.php | 2 +- .../src/Magento/Setup}/Module/DataSetup.php | 2 +- 18 files changed, 15 insertions(+), 49 deletions(-) rename dev/tests/integration/testsuite/Magento/{Framework => Setup}/Module/DataSetupTest.php (99%) rename {lib/internal/Magento/Framework => setup/src/Magento/Setup}/Module/DataSetup.php (99%) diff --git a/app/code/Magento/Authorization/Model/Resource/Setup.php b/app/code/Magento/Authorization/Model/Resource/Setup.php index d93488a18bf23..451ee7114ea5d 100644 --- a/app/code/Magento/Authorization/Model/Resource/Setup.php +++ b/app/code/Magento/Authorization/Model/Resource/Setup.php @@ -12,7 +12,7 @@ * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * Role model factory diff --git a/app/code/Magento/CheckoutAgreements/etc/di.xml b/app/code/Magento/CheckoutAgreements/etc/di.xml index b72ba8165bc5e..7469363193cb0 100644 --- a/app/code/Magento/CheckoutAgreements/etc/di.xml +++ b/app/code/Magento/CheckoutAgreements/etc/di.xml @@ -8,13 +8,6 @@ - - - - Magento\Framework\Module\DataSetup - - - diff --git a/app/code/Magento/Cms/Model/Resource/Setup.php b/app/code/Magento/Cms/Model/Resource/Setup.php index 4a6c1e1dc4b46..fba133558ce22 100644 --- a/app/code/Magento/Cms/Model/Resource/Setup.php +++ b/app/code/Magento/Cms/Model/Resource/Setup.php @@ -9,7 +9,7 @@ /** * Cms resource setup */ -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * Block factory diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index 34a6500a19055..470b2ebb8267b 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -8,7 +8,7 @@ - + @@ -625,19 +625,6 @@ - - - - Magento\Framework\Module\DataSetup - - - - - - core_setup - Magento\Framework\Module\Updater::DEFAULT_SETUP_CONNECTION - - Magento\Core\Model\Resource\Config\Data diff --git a/app/code/Magento/Dhl/Model/Resource/Setup.php b/app/code/Magento/Dhl/Model/Resource/Setup.php index 012ba3cdde645..ffc3bd7b84a93 100644 --- a/app/code/Magento/Dhl/Model/Resource/Setup.php +++ b/app/code/Magento/Dhl/Model/Resource/Setup.php @@ -7,7 +7,7 @@ use Magento\Framework\Setup\ModuleDataResourceInterface; -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * @var \Magento\Framework\Locale\ListsInterface diff --git a/app/code/Magento/Directory/Model/Resource/Setup.php b/app/code/Magento/Directory/Model/Resource/Setup.php index ab7673d6c4e56..66d453b8dc237 100644 --- a/app/code/Magento/Directory/Model/Resource/Setup.php +++ b/app/code/Magento/Directory/Model/Resource/Setup.php @@ -13,7 +13,7 @@ use Magento\Framework\Setup\ModuleDataResourceInterface; -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * @var \Magento\Directory\Helper\Data diff --git a/app/code/Magento/Eav/Model/Entity/Setup.php b/app/code/Magento/Eav/Model/Entity/Setup.php index f786c65fe9cef..8d8b58d45366b 100644 --- a/app/code/Magento/Eav/Model/Entity/Setup.php +++ b/app/code/Magento/Eav/Model/Entity/Setup.php @@ -11,7 +11,7 @@ /** * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) */ -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * @var \Magento\Framework\App\CacheInterface diff --git a/app/code/Magento/GiftMessage/Model/Resource/Setup.php b/app/code/Magento/GiftMessage/Model/Resource/Setup.php index a58c7beba1ef3..b46e462f24639 100644 --- a/app/code/Magento/GiftMessage/Model/Resource/Setup.php +++ b/app/code/Magento/GiftMessage/Model/Resource/Setup.php @@ -9,7 +9,7 @@ use Magento\Framework\Setup\ModuleDataResourceInterface; -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * @var \Magento\Catalog\Model\Resource\SetupFactory diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Setup.php b/app/code/Magento/GoogleShopping/Model/Resource/Setup.php index a2fdead1c0483..152a2e666eddf 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Setup.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Setup.php @@ -7,7 +7,7 @@ use Magento\Framework\Setup\ModuleDataResourceInterface; -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * @var \Magento\Framework\Module\Manager diff --git a/app/code/Magento/Integration/Model/Resource/Setup.php b/app/code/Magento/Integration/Model/Resource/Setup.php index 32e34d9c63814..421a3fe8518cf 100644 --- a/app/code/Magento/Integration/Model/Resource/Setup.php +++ b/app/code/Magento/Integration/Model/Resource/Setup.php @@ -11,7 +11,7 @@ /** * Resource Setup Model */ -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * @var Manager diff --git a/app/code/Magento/Reports/Model/Resource/Setup.php b/app/code/Magento/Reports/Model/Resource/Setup.php index dd6e638356393..aaf6257c6a097 100644 --- a/app/code/Magento/Reports/Model/Resource/Setup.php +++ b/app/code/Magento/Reports/Model/Resource/Setup.php @@ -11,7 +11,7 @@ use Magento\Framework\Setup\ModuleDataResourceInterface; -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * @var \Magento\Cms\Model\PageFactory diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml index 801973c00ad66..cec8e47841366 100644 --- a/app/code/Magento/Store/etc/di.xml +++ b/app/code/Magento/Store/etc/di.xml @@ -6,13 +6,6 @@ */ --> - - - - Magento\Framework\Module\DataSetup - - - Magento\Store\Model\Config\Reader\ReaderPool\Proxy diff --git a/app/code/Magento/Theme/Model/Resource/Setup.php b/app/code/Magento/Theme/Model/Resource/Setup.php index 34b58775495fb..5362ecc887e63 100644 --- a/app/code/Magento/Theme/Model/Resource/Setup.php +++ b/app/code/Magento/Theme/Model/Resource/Setup.php @@ -9,7 +9,7 @@ /** * Core resource setup */ -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * @var \Magento\Theme\Model\Resource\Theme\CollectionFactory diff --git a/app/code/Magento/User/etc/di.xml b/app/code/Magento/User/etc/di.xml index a416e89c41013..2f885188376a4 100644 --- a/app/code/Magento/User/etc/di.xml +++ b/app/code/Magento/User/etc/di.xml @@ -11,13 +11,6 @@ Magento\Framework\Acl\Cache\Proxy - - - - Magento\Framework\Module\DataSetup - - - diff --git a/app/code/Magento/Weee/Model/Resource/Setup.php b/app/code/Magento/Weee/Model/Resource/Setup.php index f65886925f71b..cf1646f9a3fa6 100644 --- a/app/code/Magento/Weee/Model/Resource/Setup.php +++ b/app/code/Magento/Weee/Model/Resource/Setup.php @@ -9,7 +9,7 @@ /** * Setup Model of Weee Module */ -class Setup extends \Magento\Framework\Module\DataSetup +class Setup extends \Magento\Setup\Module\DataSetup { /** * @var \Magento\Sales\Model\Resource\SetupFactory diff --git a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php similarity index 99% rename from dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php rename to dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php index a61a8b8dda81d..056c00a745e6a 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Module/DataSetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php @@ -3,7 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Framework\Module; +namespace Magento\Setup\Module; use Magento\Framework\Setup\ModuleDataResourceInterface; diff --git a/lib/internal/Magento/Framework/Module/Setup/Migration.php b/lib/internal/Magento/Framework/Module/Setup/Migration.php index 796c686e47353..f8ffa46888279 100644 --- a/lib/internal/Magento/Framework/Module/Setup/Migration.php +++ b/lib/internal/Magento/Framework/Module/Setup/Migration.php @@ -13,7 +13,7 @@ * @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Migration extends \Magento\Framework\Module\DataSetup +class Migration extends \Magento\Setup\Module\DataSetup { /**#@+ * Type of field content where class alias is used diff --git a/lib/internal/Magento/Framework/Module/DataSetup.php b/setup/src/Magento/Setup/Module/DataSetup.php similarity index 99% rename from lib/internal/Magento/Framework/Module/DataSetup.php rename to setup/src/Magento/Setup/Module/DataSetup.php index 9246205c4734e..04b00a94429b0 100644 --- a/lib/internal/Magento/Framework/Module/DataSetup.php +++ b/setup/src/Magento/Setup/Module/DataSetup.php @@ -5,7 +5,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Framework\Module; +namespace Magento\Setup\Module; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Setup\ModuleDataResourceInterface; From 22465b2422d2b618eb65cb472163bbdf9c5e3026 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 11 Feb 2015 15:02:50 -0600 Subject: [PATCH 017/106] MAGETWO-33887: Create SPI interfaces and context class - fixed usage of moved DataSetup model --- .../Framework/DB/Adapter/InterfaceTest.php | 2 +- .../Magento/Setup/Module/DataSetupTest.php | 4 +-- .../Test/Legacy/_files/obsolete_methods.php | 26 +++++++++---------- .../Legacy/_files/obsolete_properties.php | 22 ++++++++-------- .../Magento/Tools/Migration/themes_view.php | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php index 86e2979a169db..a7ffaa387a28a 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php @@ -34,7 +34,7 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase protected function setUp() { $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Framework\Module\DataSetup', + 'Magento\Setup\Module\DataSetup', [ 'resourceName' => 'core_setup', 'moduleName' => 'Magento_Core' diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php index 056c00a745e6a..0bc00c47bc861 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php @@ -17,7 +17,7 @@ class DataSetupTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Framework\Module\DataSetup', + 'Magento\Setup\Module\DataSetup', ['resourceName' => 'default_setup', 'moduleName' => 'Magento_Core'] ); } @@ -78,7 +78,7 @@ public function testDeleteTableRow() } /** - * @covers \Magento\Framework\Module\DataSetup::updateTableRow + * @covers \Magento\Setup\Module\DataSetup::updateTableRow * @expectedException \Zend_Db_Statement_Exception */ public function testUpdateTableRowNameConversion() diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index b8b1fea1a7b96..8ea980483d11f 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -1944,21 +1944,21 @@ ['_debugStat', 'Magento\Framework\DB\Adapter\Pdo\Mysql', 'Magento\Framework\DB\Logger\File::logStats'], ['_debugException', 'Magento\Framework\DB\Adapter\Pdo\Mysql', 'Magento\Framework\DB\Logger\File::critical'], ['_debugWriteToFile', 'Magento\Framework\DB\Adapter\Pdo\Mysql', 'Magento\Framework\DB\Logger\File::log'], - ['applyDataUpdates', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::applyDataUpdates'], - ['_installData', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_installData'], - ['_upgradeData', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_upgradeData'], - ['_getAvailableDataFiles', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_getAvailableDataFiles'], - ['_modifyResourceDb', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_modifyResourceDb'], - ['_includeFile', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_includeFile'], - ['_getModifySqlFiles', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_getModifySqlFiles'], - ['getTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::getTableRow'], - ['deleteTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::deleteTableRow'], - ['updateTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::updateTableRow'], + ['applyDataUpdates', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::applyDataUpdates'], + ['_installData', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_installData'], + ['_upgradeData', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_upgradeData'], + ['_getAvailableDataFiles', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_getAvailableDataFiles'], + ['_modifyResourceDb', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_modifyResourceDb'], + ['_includeFile', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_includeFile'], + ['_getModifySqlFiles', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_getModifySqlFiles'], + ['getTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::getTableRow'], + ['deleteTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::deleteTableRow'], + ['updateTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::updateTableRow'], ['getCallAfterApplyAllUpdates', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::getCallAfterApplyAllUpdates'], ['afterApplyAllUpdates', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataResourceInterface::afterApplyAllUpdates'], - ['getEventManager', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::getEventManager'], - ['getFilesystem', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::getFilesystem'], - ['createMigrationSetup', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::createMigrationSetup'], + ['getEventManager', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::getEventManager'], + ['getFilesystem', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::getFilesystem'], + ['createMigrationSetup', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::createMigrationSetup'], ['getModules', 'Magento\Framework\Module\ModuleList', 'getAll'], ['getModules', 'Magento\Framework\Module\ModuleListInterface', 'getAll'], ['getModule', 'Magento\Framework\Module\ModuleList', 'getOne'], diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php index 89dcd2f0e9bbb..dfb7e9a492fdd 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php @@ -351,17 +351,17 @@ ['_debugFile', 'Magento\Framework\DB\Adapter\Pdo\Mysql', 'Magento\Framework\DB\Logger\File'], ['_filesystem', 'Magento\Framework\DB\Adapter\Pdo\Mysql', 'Magento\Framework\DB\Logger\File'], ['_debugTimer', 'Magento\Framework\DB\Adapter\Pdo\Mysql', 'Magento\Framework\DB\Logger\LoggerAbstract'], - ['_resourceName', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_resourceName'], - ['_moduleConfig', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_moduleConfig'], - ['_callAfterApplyAllUpdates', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_callAfterApplyAllUpdates'], - ['_setupCache', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_setupCache'], - ['_modulesReader', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_modulesReader'], - ['_eventManager', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_eventManager'], - ['_logger', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_logger'], - ['_resource', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_resource'], - ['_migrationFactory', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::_migrationFactory'], - ['filesystem', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::filesystem'], - ['modulesDir', 'Magento\Framework\Module\Setup', 'Magento\Framework\Module\DataSetup::modulesDir'], + ['_resourceName', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_resourceName'], + ['_moduleConfig', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_moduleConfig'], + ['_callAfterApplyAllUpdates', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_callAfterApplyAllUpdates'], + ['_setupCache', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_setupCache'], + ['_modulesReader', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_modulesReader'], + ['_eventManager', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_eventManager'], + ['_logger', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_logger'], + ['_resource', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_resource'], + ['_migrationFactory', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_migrationFactory'], + ['filesystem', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::filesystem'], + ['modulesDir', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::modulesDir'], ['_directoryData', 'Magento\Customer\Model\Attribute\Data\Postcode', 'Magento\Customer\Model\Attribute\Data\Postcode::directoryHelper'], ['_conditionModels', 'Magento\Rule\Model\Condition\Combine'], ['_lables', 'Magento\SalesRule\Model\Rule'], diff --git a/dev/tools/Magento/Tools/Migration/themes_view.php b/dev/tools/Magento/Tools/Migration/themes_view.php index 969bfd2f8ca5a..883d52be33dc7 100644 --- a/dev/tools/Magento/Tools/Migration/themes_view.php +++ b/dev/tools/Magento/Tools/Migration/themes_view.php @@ -36,7 +36,7 @@ function updateFieldForTable($objectManager, $table, $col) { /** @var $installer \Magento\Framework\Setup\ModuleDataResourceInterface */ - $installer = $objectManager->create('Magento\Framework\Module\DataSetup'); + $installer = $objectManager->create('Magento\Setup\Module\DataSetup'); $installer->startSetup(); $table = $installer->getTable($table); From 5d0bc7f84ca03d040138884111996ccaca57f376 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 11 Feb 2015 15:22:11 -0600 Subject: [PATCH 018/106] MAGETWO-33887: Create SPI interfaces and context class - fixed name of a class - utilize factory instead of a setup class as a dependency to ensure that correct instance of the setup resource is passed to it --- app/code/Magento/Customer/Setup/Customer.php | 4 +-- .../Magento/Customer/Setup/InstallData.php | 34 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/app/code/Magento/Customer/Setup/Customer.php b/app/code/Magento/Customer/Setup/Customer.php index 0694c315e37f3..3d22693c20a16 100644 --- a/app/code/Magento/Customer/Setup/Customer.php +++ b/app/code/Magento/Customer/Setup/Customer.php @@ -5,7 +5,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Customer\Setup\Customer; +namespace Magento\Customer\Setup; use Magento\Eav\Model\Config; use Magento\Eav\Model\Entity\Setup\Context; @@ -14,7 +14,7 @@ use Magento\Framework\Setup\ModuleDataResourceInterface; use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; -class Setup extends Eav +class Customer extends Eav { /** * @var Config diff --git a/app/code/Magento/Customer/Setup/InstallData.php b/app/code/Magento/Customer/Setup/InstallData.php index 622de68da42a7..bd347ed260637 100644 --- a/app/code/Magento/Customer/Setup/InstallData.php +++ b/app/code/Magento/Customer/Setup/InstallData.php @@ -5,7 +5,6 @@ */ namespace Magento\Customer\Setup; -use Magento\Customer\Setup\Customer\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataResourceInterface; @@ -13,13 +12,13 @@ class InstallData implements InstallDataInterface { /** - * @var Setup + * @var CustomerFactory */ - private $customerSetup; + private $customerSetupFactory; - public function __construct(Setup $customerSetup) + public function __construct(CustomerFactory $customerSetupFactory) { - $this->customerSetup = $customerSetup; + $this->customerSetupFactory = $customerSetupFactory; } /** @@ -27,6 +26,9 @@ public function __construct(Setup $customerSetup) */ public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) { + /** @var Customer $customerSetup */ + $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]); + $setup->startSetup(); // insert default customer groups @@ -47,19 +49,19 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa ['customer_group_id' => 3, 'customer_group_code' => 'Retailer', 'tax_class_id' => 3] ); - $this->customerSetup->installEntities(); + $customerSetup->installEntities(); - $this->customerSetup->installCustomerForms(); + $customerSetup->installCustomerForms(); // Add reset password link token attribute - $this->customerSetup->addAttribute( + $customerSetup->addAttribute( 'customer', 'rp_token', ['type' => 'varchar', 'input' => 'hidden', 'visible' => false, 'required' => false] ); // Add reset password link token creation date attribute - $this->customerSetup->addAttribute( + $customerSetup->addAttribute( 'customer', 'rp_token_created_at', [ @@ -74,7 +76,7 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa // Add VAT attributes to customer address $disableAGCAttributeCode = 'disable_auto_group_change'; - $this->customerSetup->addAttribute( + $customerSetup->addAttribute( 'customer', $disableAGCAttributeCode, [ @@ -87,7 +89,7 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa ] ); - $disableAGCAttribute = $this->customerSetup->getEavConfig()->getAttribute('customer', $disableAGCAttributeCode); + $disableAGCAttribute = $customerSetup->getEavConfig()->getAttribute('customer', $disableAGCAttributeCode); $disableAGCAttribute->setData('used_in_forms', ['adminhtml_customer']); $disableAGCAttribute->save(); @@ -127,22 +129,22 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa ]; foreach ($attributesInfo as $attributeCode => $attributeParams) { - $this->customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams); + $customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams); } - $vatIdAttribute = $this->customerSetup->getEavConfig()->getAttribute('customer_address', 'vat_id'); + $vatIdAttribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'vat_id'); $vatIdAttribute->setData( 'used_in_forms', ['adminhtml_customer_address', 'customer_address_edit', 'customer_register_address'] ); $vatIdAttribute->save(); - $entities = $this->customerSetup->getDefaultEntities(); + $entities = $customerSetup->getDefaultEntities(); foreach ($entities as $entityName => $entity) { - $this->customerSetup->addEntityType($entityName, $entity); + $customerSetup->addEntityType($entityName, $entity); } - $this->customerSetup->updateAttribute( + $customerSetup->updateAttribute( 'customer_address', 'street', 'backend_model', From 872f04be83dfd2576421f93b25992cd9227e4a09 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 11 Feb 2015 15:38:06 -0600 Subject: [PATCH 019/106] MAGETWO-33887: Create SPI interfaces and context class - code style fix --- app/code/Magento/Customer/Setup/InstallData.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Customer/Setup/InstallData.php b/app/code/Magento/Customer/Setup/InstallData.php index bd347ed260637..6d3bd31ce2371 100644 --- a/app/code/Magento/Customer/Setup/InstallData.php +++ b/app/code/Magento/Customer/Setup/InstallData.php @@ -16,6 +16,9 @@ class InstallData implements InstallDataInterface */ private $customerSetupFactory; + /** + * @param CustomerFactory $customerSetupFactory + */ public function __construct(CustomerFactory $customerSetupFactory) { $this->customerSetupFactory = $customerSetupFactory; From b85076c822fc3e74e5befae78a55c9948ad80d76 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 11 Feb 2015 16:39:51 -0600 Subject: [PATCH 020/106] MAGETWO-33887: Create SPI interfaces and context class - temporary added old install scripts to phpcpd blacklist - code style fix --- app/code/Magento/Customer/Setup/Customer.php | 6 +++--- .../Magento/Test/Php/_files/phpcpd/blacklist/common.txt | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Setup/Customer.php b/app/code/Magento/Customer/Setup/Customer.php index 3d22693c20a16..ae82441cd5262 100644 --- a/app/code/Magento/Customer/Setup/Customer.php +++ b/app/code/Magento/Customer/Setup/Customer.php @@ -22,18 +22,18 @@ class Customer extends Eav protected $eavConfig; /** - * @param Config $eavConfig * @param ModuleDataResourceInterface $setup * @param Context $context * @param CacheInterface $cache * @param CollectionFactory $attrGroupCollectionFactory + * @param Config $eavConfig */ public function __construct( - Config $eavConfig, ModuleDataResourceInterface $setup, Context $context, CacheInterface $cache, - CollectionFactory $attrGroupCollectionFactory + CollectionFactory $attrGroupCollectionFactory, + Config $eavConfig ) { $this->eavConfig = $eavConfig; parent::__construct($setup, $context, $cache, $attrGroupCollectionFactory); diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 150a66be8a961..f27447fc817fb 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -148,3 +148,9 @@ Magento/Weee/Model/Resource Magento/Theme/Model/Design/Backend Magento/Core/Model/Resource/Layout/Link Magento/Theme/Model/Resource/Design + +app/code/Magento/Customer/data/customer_setup/data-install-2.0.0.php +app/code/Magento/Customer/Model/Resource/Setup.php +app/code/Magento/Eav/Model/Entity/Setup.php +app/code/Magento/GoogleShopping/data/googleshopping_setup/data-install-2.0.0.php +app/code/Magento/GoogleShopping/Model/Resource/Setup.php From f53fb29cd328eb07ea31337efbc919bafeec6bdc Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Wed, 11 Feb 2015 17:19:34 -0600 Subject: [PATCH 021/106] MAGETWO-33884: Changes to database and module.xml - Changes according to CR. --- .../Magento/Framework/Module/Resource.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/Resource.php b/lib/internal/Magento/Framework/Module/Resource.php index 3dcabfbb789d2..9a98c1bda8b8d 100644 --- a/lib/internal/Magento/Framework/Module/Resource.php +++ b/lib/internal/Magento/Framework/Module/Resource.php @@ -77,31 +77,31 @@ protected function _loadVersion($needType) /** * {@inheritdoc} */ - public function getDbVersion($resName) + public function getDbVersion($moduleName) { if (!$this->_getReadAdapter()) { return false; } $this->_loadVersion('db'); - return isset(self::$_versions[$resName]) ? self::$_versions[$resName] : false; + return isset(self::$_versions[$moduleName]) ? self::$_versions[$moduleName] : false; } /** * {@inheritdoc} */ - public function setDbVersion($resName, $version) + public function setDbVersion($moduleName, $version) { - $dbModuleInfo = ['module' => $resName, 'schema_version' => $version]; + $dbModuleInfo = ['module' => $moduleName, 'schema_version' => $version]; - if ($this->getDbVersion($resName)) { - self::$_versions[$resName] = $version; + if ($this->getDbVersion($moduleName)) { + self::$_versions[$moduleName] = $version; return $this->_getWriteAdapter()->update( $this->getMainTable(), $dbModuleInfo, - ['module = ?' => $resName] + ['module = ?' => $moduleName] ); } else { - self::$_versions[$resName] = $version; + self::$_versions[$moduleName] = $version; return $this->_getWriteAdapter()->insert($this->getMainTable(), $dbModuleInfo); } } @@ -109,27 +109,27 @@ public function setDbVersion($resName, $version) /** * {@inheritdoc} */ - public function getDataVersion($resName) + public function getDataVersion($moduleName) { if (!$this->_getReadAdapter()) { return false; } $this->_loadVersion('data'); - return isset(self::$_dataVersions[$resName]) ? self::$_dataVersions[$resName] : false; + return isset(self::$_dataVersions[$moduleName]) ? self::$_dataVersions[$moduleName] : false; } /** * {@inheritdoc} */ - public function setDataVersion($resName, $version) + public function setDataVersion($moduleName, $version) { - $data = ['module' => $resName, 'data_version' => $version]; + $data = ['module' => $moduleName, 'data_version' => $version]; - if ($this->getDbVersion($resName) || $this->getDataVersion($resName)) { - self::$_dataVersions[$resName] = $version; - $this->_getWriteAdapter()->update($this->getMainTable(), $data, ['module = ?' => $resName]); + if ($this->getDbVersion($moduleName) || $this->getDataVersion($moduleName)) { + self::$_dataVersions[$moduleName] = $version; + $this->_getWriteAdapter()->update($this->getMainTable(), $data, ['module = ?' => $moduleName]); } else { - self::$_dataVersions[$resName] = $version; + self::$_dataVersions[$moduleName] = $version; $this->_getWriteAdapter()->insert($this->getMainTable(), $data); } } From 476cc5afce1b462816b846fa7991e909c68bafa0 Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Wed, 11 Feb 2015 17:36:25 -0600 Subject: [PATCH 022/106] MAGETWO-33884: Changes to database and module.xml - Removed unused login according to CR. --- .../Magento/Core/data/core_setup/data-install-2.0.0.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php b/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php index 66445eb56a101..f630e44654a09 100644 --- a/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php +++ b/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php @@ -32,12 +32,4 @@ $installer->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']); } -/** - * Delete rows by condition from setup_module - */ -$tableName = $installer->getTable('setup_module'); -if ($tableName) { - $installer->getConnection()->delete($tableName, ['module = ?' => 'admin_setup']); -} - $installer->endSetup(); From ee447e6fc11bb8e433d5fe7defd69c696fe8ddfb Mon Sep 17 00:00:00 2001 From: Eddie Lau Date: Wed, 11 Feb 2015 17:43:38 -0600 Subject: [PATCH 023/106] MAGETWO-33886: Move sql/data version logic to setup - adding checking for setup_module table existence --- setup/src/Magento/Setup/Model/Installer.php | 53 +++++++++++---------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 0c1dcb5387f7a..0edb37ad8a492 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -539,7 +539,7 @@ public function installDeploymentConfig($data) } /** - * Set up setup_module table to register modules' versions + * Set up setup_module table to register modules' versions, skip this process if it already exists * * @return void */ @@ -547,30 +547,33 @@ private function setupModuleRegistry() { $registrySetup = $this->setupFactory->createSetup(); $connection = $registrySetup->getConnection(); - /** - * Create table 'setup_module' - */ - $table = $connection->newTable($registrySetup->getTable('setup_module')) - ->addColumn( - 'module', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false, 'primary' => true], - 'Module' - )->addColumn( - 'schema_version', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Schema Version' - )->addColumn( - 'data_version', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Data Version' - )->setComment('Module versions registry'); - $connection->createTable($table); + + if (!$connection->isTableExists($registrySetup->getTable('setup_module'))) { + /** + * Create table 'setup_module' + */ + $table = $connection->newTable($registrySetup->getTable('setup_module')) + ->addColumn( + 'module', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false, 'primary' => true], + 'Module' + )->addColumn( + 'schema_version', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Schema Version' + )->addColumn( + 'data_version', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Data Version' + )->setComment('Module versions registry'); + $connection->createTable($table); + } } /** From 8c2f94afe9e7e4c67cc332db22f0bd8efcaed182 Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Wed, 11 Feb 2015 17:52:50 -0600 Subject: [PATCH 024/106] MAGETWO-33884: Changes to database and module.xml - Fixed defect from CR. --- .../Magento/Framework/Module/Plugin/DbStatusValidatorTest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php index 8faf6cccc51ab..86ffba8d0e565 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php @@ -24,9 +24,6 @@ public function testValidationOutdatedDb() /** @var \Magento\Framework\Module\ModuleListInterface $moduleList */ $moduleList = $objectManager->get('Magento\Framework\Module\ModuleListInterface'); - /** @var \Magento\Framework\Module\ResourceResolverInterface $resourceResolver */ - $resourceResolver = $objectManager->get('Magento\Framework\Module\ResourceResolverInterface'); - // get first module name, we don't care which one it is. foreach ($moduleList->getNames() as $moduleName) { $moduleNameToTest = $moduleName; From b852c5c3697280443359d786db39ffbd72ec293a Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Thu, 12 Feb 2015 10:15:14 -0600 Subject: [PATCH 025/106] MAGETWO-33884: Changes to database and module.xml - Fixed parameter naming in ResourceInterface according to CR. --- .../Framework/Module/ResourceInterface.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/ResourceInterface.php b/lib/internal/Magento/Framework/Module/ResourceInterface.php index 563c505410bd5..4feab58ffb35c 100644 --- a/lib/internal/Magento/Framework/Module/ResourceInterface.php +++ b/lib/internal/Magento/Framework/Module/ResourceInterface.php @@ -13,34 +13,34 @@ interface ResourceInterface /** * Get Module version from DB * - * @param string $resName + * @param string $moduleName * @return false|string */ - public function getDbVersion($resName); + public function getDbVersion($moduleName); /** * Get resource data version * - * @param string $resName + * @param string $moduleName * @return string|false */ - public function getDataVersion($resName); + public function getDataVersion($moduleName); /** * Set Module version * - * @param string $resName + * @param string $moduleName * @param string $version * @return int */ - public function setDbVersion($resName, $version); + public function setDbVersion($moduleName, $version); /** * Set resource data version * - * @param string $resName + * @param string $moduleName * @param string $version * @return void */ - public function setDataVersion($resName, $version); + public function setDataVersion($moduleName, $version); } From d7b59a21b3a229014655c962dbd33fcdd4792a48 Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Thu, 12 Feb 2015 10:24:52 -0600 Subject: [PATCH 026/106] MAGETWO-33884: Changes to database and module.xml - fixed field according to CR. --- lib/internal/Magento/Framework/Module/Resource.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/Resource.php b/lib/internal/Magento/Framework/Module/Resource.php index 9a98c1bda8b8d..f9460ee033466 100644 --- a/lib/internal/Magento/Framework/Module/Resource.php +++ b/lib/internal/Magento/Framework/Module/Resource.php @@ -19,7 +19,7 @@ class Resource extends \Magento\Framework\Model\Resource\Db\AbstractDb implement * * @var array */ - protected static $_versions = null; + protected static $schema_versions = null; /** * Resource data versions cache array @@ -50,8 +50,8 @@ protected function _construct() */ protected function _loadVersion($needType) { - if ($needType == 'db' && is_null(self::$_versions) || $needType == 'data' && is_null(self::$_dataVersions)) { - self::$_versions = []; + if ($needType == 'db' && is_null(self::$schema_versions) || $needType == 'data' && is_null(self::$_dataVersions)) { + self::$schema_versions = []; // Db version column always exists self::$_dataVersions = null; // Data version array will be filled only if Data column exist @@ -60,7 +60,7 @@ protected function _loadVersion($needType) $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), '*'); $rowset = $this->_getReadAdapter()->fetchAll($select); foreach ($rowset as $row) { - self::$_versions[$row['module']] = $row['schema_version']; + self::$schema_versions[$row['module']] = $row['schema_version']; if (array_key_exists('data_version', $row)) { if (is_null(self::$_dataVersions)) { self::$_dataVersions = []; @@ -83,7 +83,7 @@ public function getDbVersion($moduleName) return false; } $this->_loadVersion('db'); - return isset(self::$_versions[$moduleName]) ? self::$_versions[$moduleName] : false; + return isset(self::$schema_versions[$moduleName]) ? self::$schema_versions[$moduleName] : false; } /** @@ -94,14 +94,14 @@ public function setDbVersion($moduleName, $version) $dbModuleInfo = ['module' => $moduleName, 'schema_version' => $version]; if ($this->getDbVersion($moduleName)) { - self::$_versions[$moduleName] = $version; + self::$schema_versions[$moduleName] = $version; return $this->_getWriteAdapter()->update( $this->getMainTable(), $dbModuleInfo, ['module = ?' => $moduleName] ); } else { - self::$_versions[$moduleName] = $version; + self::$schema_versions[$moduleName] = $version; return $this->_getWriteAdapter()->insert($this->getMainTable(), $dbModuleInfo); } } From e06964737603b9b4b9a4dbd2aadeee8cc5e2da13 Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Thu, 12 Feb 2015 10:31:43 -0600 Subject: [PATCH 027/106] MAGETWO-33884: Changes to database and module.xml - added value initialization in test. --- .../Magento/Framework/Module/Plugin/DbStatusValidatorTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php index 86ffba8d0e565..4bcae52e7362b 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php @@ -24,6 +24,8 @@ public function testValidationOutdatedDb() /** @var \Magento\Framework\Module\ModuleListInterface $moduleList */ $moduleList = $objectManager->get('Magento\Framework\Module\ModuleListInterface'); + $moduleNameToTest = ''; + // get first module name, we don't care which one it is. foreach ($moduleList->getNames() as $moduleName) { $moduleNameToTest = $moduleName; From 6c529dee77efce72d5b68d707744686cdd88745f Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Thu, 12 Feb 2015 17:00:20 -0600 Subject: [PATCH 028/106] MAGETWO-33884: Changes to database and module.xml - Fixed code style according to CR. --- .../Magento/Framework/Module/Resource.php | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/Resource.php b/lib/internal/Magento/Framework/Module/Resource.php index f9460ee033466..edb2834747fbb 100644 --- a/lib/internal/Magento/Framework/Module/Resource.php +++ b/lib/internal/Magento/Framework/Module/Resource.php @@ -19,14 +19,14 @@ class Resource extends \Magento\Framework\Model\Resource\Db\AbstractDb implement * * @var array */ - protected static $schema_versions = null; + protected static $schemaVersions = null; /** * Resource data versions cache array * * @var array */ - protected static $_dataVersions = null; + protected static $dataVersions = null; /** * Define main table @@ -50,22 +50,22 @@ protected function _construct() */ protected function _loadVersion($needType) { - if ($needType == 'db' && is_null(self::$schema_versions) || $needType == 'data' && is_null(self::$_dataVersions)) { - self::$schema_versions = []; + if ($needType == 'db' && is_null(self::$schemaVersions) || $needType == 'data' && is_null(self::$dataVersions)) { + self::$schemaVersions = []; // Db version column always exists - self::$_dataVersions = null; + self::$dataVersions = null; // Data version array will be filled only if Data column exist if ($this->_getReadAdapter()->isTableExists($this->getMainTable())) { $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), '*'); $rowset = $this->_getReadAdapter()->fetchAll($select); foreach ($rowset as $row) { - self::$schema_versions[$row['module']] = $row['schema_version']; + self::$schemaVersions[$row['module']] = $row['schema_version']; if (array_key_exists('data_version', $row)) { - if (is_null(self::$_dataVersions)) { - self::$_dataVersions = []; + if (is_null(self::$dataVersions)) { + self::$dataVersions = []; } - self::$_dataVersions[$row['module']] = $row['data_version']; + self::$dataVersions[$row['module']] = $row['data_version']; } } } @@ -83,7 +83,7 @@ public function getDbVersion($moduleName) return false; } $this->_loadVersion('db'); - return isset(self::$schema_versions[$moduleName]) ? self::$schema_versions[$moduleName] : false; + return isset(self::$schemaVersions[$moduleName]) ? self::$schemaVersions[$moduleName] : false; } /** @@ -94,14 +94,14 @@ public function setDbVersion($moduleName, $version) $dbModuleInfo = ['module' => $moduleName, 'schema_version' => $version]; if ($this->getDbVersion($moduleName)) { - self::$schema_versions[$moduleName] = $version; + self::$schemaVersions[$moduleName] = $version; return $this->_getWriteAdapter()->update( $this->getMainTable(), $dbModuleInfo, ['module = ?' => $moduleName] ); } else { - self::$schema_versions[$moduleName] = $version; + self::$schemaVersions[$moduleName] = $version; return $this->_getWriteAdapter()->insert($this->getMainTable(), $dbModuleInfo); } } @@ -115,7 +115,7 @@ public function getDataVersion($moduleName) return false; } $this->_loadVersion('data'); - return isset(self::$_dataVersions[$moduleName]) ? self::$_dataVersions[$moduleName] : false; + return isset(self::$dataVersions[$moduleName]) ? self::$dataVersions[$moduleName] : false; } /** @@ -126,10 +126,10 @@ public function setDataVersion($moduleName, $version) $data = ['module' => $moduleName, 'data_version' => $version]; if ($this->getDbVersion($moduleName) || $this->getDataVersion($moduleName)) { - self::$_dataVersions[$moduleName] = $version; + self::$dataVersions[$moduleName] = $version; $this->_getWriteAdapter()->update($this->getMainTable(), $data, ['module = ?' => $moduleName]); } else { - self::$_dataVersions[$moduleName] = $version; + self::$dataVersions[$moduleName] = $version; $this->_getWriteAdapter()->insert($this->getMainTable(), $data); } } From 64f6db7923d71d1d577df28ba5c09d73812db9c6 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Fri, 13 Feb 2015 09:55:45 -0600 Subject: [PATCH 029/106] MAGETWO-33887: Create SPI interfaces and context class - converted install data scripts for modules with custom Setup models --- .../AuthorizationFactory.php} | 16 +- .../Authorization/Setup/InstallData.php | 81 + .../data-install-2.0.0.php | 60 - app/code/Magento/Authorization/etc/di.xml | 7 - app/code/Magento/Bundle/Setup/InstallData.php | 197 +++ .../data/bundle_setup/data-install-2.0.0.php | 169 -- app/code/Magento/Bundle/etc/di.xml | 7 - .../Setup.php => Setup/CategorySetup.php} | 63 +- .../Magento/Catalog/Setup/InstallData.php | 294 ++++ .../data/catalog_setup/data-install-2.0.0.php | 252 --- app/code/Magento/Catalog/etc/di.xml | 7 - .../CatalogInventory/Setup/InstallData.php | 52 + .../data-install-2.0.0.php | 26 - app/code/Magento/CatalogInventory/etc/di.xml | 7 - .../CatalogUrlRewrite/Setup/InstallData.php | 90 ++ .../data-install-2.0.0.php | 60 - app/code/Magento/CatalogUrlRewrite/etc/di.xml | 7 - .../Magento/Checkout/Model/Resource/Setup.php | 55 - .../Magento/Checkout/Setup/InstallData.php | 811 ++++++++++ .../checkout_setup/data-install-2.0.0.php | 772 ---------- app/code/Magento/Checkout/etc/di.xml | 7 - app/code/Magento/Cms/Model/Resource/Setup.php | 68 - .../InstallData.php} | 256 ++-- app/code/Magento/Cms/etc/di.xml | 11 +- .../ConfigurableProduct/Setup/InstallData.php | 65 + .../data-install-2.0.0.php | 37 - .../Magento/ConfigurableProduct/etc/di.xml | 7 - .../Magento/Customer/Model/Resource/Setup.php | 460 ------ .../Setup/{Customer.php => CustomerSetup.php} | 4 +- .../Magento/Customer/Setup/InstallData.php | 13 +- .../customer_setup/data-install-2.0.0.php | 143 -- app/code/Magento/Customer/etc/di.xml | 7 - app/code/Magento/Dhl/Model/Resource/Setup.php | 42 - app/code/Magento/Dhl/Setup/InstallData.php | 57 + .../Dhl/data/dhl_setup/data-install-2.0.0.php | 30 - app/code/Magento/Dhl/etc/di.xml | 7 - .../Directory/Model/Resource/Setup.php | 48 - .../Magento/Directory/Setup/InstallData.php | 855 +++++++++++ .../directory_setup/data-install-2.0.0.php | 832 ---------- app/code/Magento/Directory/etc/di.xml | 7 - .../Downloadable/Setup/InstallData.php | 167 ++ .../downloadable_setup/data-install-2.0.0.php | 138 -- app/code/Magento/Downloadable/etc/di.xml | 7 - app/code/Magento/Eav/Model/Entity/Setup.php | 1353 ----------------- .../Eav/Setup/{Eav.php => EavSetup.php} | 3 +- app/code/Magento/Eav/Setup/InstallData.php | 107 ++ .../Eav/data/eav_setup/data-upgrade-2.0.0.php | 80 - app/code/Magento/Eav/etc/di.xml | 7 - .../GiftMessage/Model/Resource/Setup.php | 90 -- .../Magento/GiftMessage/Setup/InstallData.php | 116 ++ .../giftmessage_setup/data-install-2.0.0.php | 64 - app/code/Magento/GiftMessage/etc/di.xml | 7 - .../GoogleShopping/Model/Resource/Setup.php | 50 - .../data-install-2.0.0.php | 47 - app/code/Magento/GoogleShopping/etc/di.xml | 7 - .../GroupedProduct/Setup/InstallData.php | 85 ++ .../data-install-2.0.0.php | 56 - app/code/Magento/GroupedProduct/etc/di.xml | 7 - app/code/Magento/Msrp/Setup/InstallData.php | 92 ++ .../data/msrp_setup/data-install-2.0.0.php | 63 - app/code/Magento/Msrp/etc/di.xml | 7 - app/code/Magento/Quote/Setup/InstallData.php | 51 + .../Setup.php => Setup/QuoteSetup.php} | 61 +- .../data/quote_setup/data-install-2.0.0.php | 23 - .../Magento/Reports/Model/Resource/Setup.php | 46 - .../Magento/Reports/Setup/InstallData.php | 87 ++ .../data/reports_setup/data-install-2.0.0.php | 63 - app/code/Magento/Reports/etc/di.xml | 7 - app/code/Magento/Sales/Setup/InstallData.php | 149 ++ .../Setup.php => Setup/SalesSetup.php} | 80 +- .../data/sales_setup/data-install-2.0.0.php | 121 -- app/code/Magento/Sales/etc/di.xml | 7 - app/code/Magento/Tax/Model/Resource/Setup.php | 91 -- app/code/Magento/Tax/Setup/InstallData.php | 112 ++ app/code/Magento/Tax/Setup/TaxSetup.php | 73 + .../Tax/data/tax_setup/data-install-2.0.0.php | 84 - .../Magento/Theme/Model/Resource/Setup.php | 60 - app/code/Magento/Theme/Setup/InstallData.php | 108 ++ .../data/theme_setup/data-install-2.0.0.php | 57 - app/code/Magento/Theme/etc/di.xml | 7 - .../Magento/Weee/Model/Resource/Setup.php | 71 - app/code/Magento/Weee/Setup/InstallData.php | 90 ++ .../data/weee_setup/data-install-2.0.0.php | 48 - app/code/Magento/Weee/etc/di.xml | 7 - .../Filter/Price/_files/products_advanced.php | 4 +- .../Filter/Price/_files/products_base.php | 4 +- .../_files/attribute_weight_filterable.php | 4 +- .../Filter/_files/attribute_with_option.php | 4 +- .../Magento/Catalog/_files/categories.php | 3 +- .../Catalog/_files/filterable_attributes.php | 4 +- .../Catalog/_files/multiselect_attribute.php | 4 +- .../Catalog/_files/price_row_fixture.php | 3 +- ...roduct_attribute_with_invalid_apply_to.php | 4 +- .../products_with_multiselect_attribute.php | 4 +- .../Magento/Catalog/_files/row_fixture.php | 3 +- .../Magento/CatalogRule/_files/attribute.php | 4 +- .../CatalogUrlRewrite/_files/categories.php | 4 - .../_files/categories_with_products.php | 3 +- .../categories_with_products_rollback.php | 4 - .../_files/configurable_attribute.php | 4 +- .../_files/product_configurable.php | 4 +- .../_files/attribute_user_defined_address.php | 9 +- ..._user_defined_address_custom_attribute.php | 14 +- .../Magento/Weee/_files/product_with_fpt.php | 3 +- .../testsuite/fixtures/catalog_category.php | 3 +- .../Test/Legacy/_files/obsolete_classes.php | 3 +- .../Test/Legacy/_files/obsolete_methods.php | 8 - .../CategorySetupTest.php} | 8 +- .../Magento/Framework/Module/UpdaterTest.php | 4 +- .../SetupTest.php => Setup/TaxSetupTest.php} | 8 +- 110 files changed, 4060 insertions(+), 6109 deletions(-) rename app/code/Magento/Authorization/{Model/Resource/Setup.php => Setup/AuthorizationFactory.php} (78%) create mode 100644 app/code/Magento/Authorization/Setup/InstallData.php delete mode 100644 app/code/Magento/Authorization/data/authorization_setup/data-install-2.0.0.php create mode 100644 app/code/Magento/Bundle/Setup/InstallData.php delete mode 100644 app/code/Magento/Bundle/data/bundle_setup/data-install-2.0.0.php rename app/code/Magento/Catalog/{Model/Resource/Setup.php => Setup/CategorySetup.php} (95%) create mode 100644 app/code/Magento/Catalog/Setup/InstallData.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-install-2.0.0.php create mode 100644 app/code/Magento/CatalogInventory/Setup/InstallData.php delete mode 100644 app/code/Magento/CatalogInventory/data/cataloginventory_setup/data-install-2.0.0.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php delete mode 100644 app/code/Magento/CatalogUrlRewrite/data/catalogurlrewrite_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Checkout/Model/Resource/Setup.php create mode 100644 app/code/Magento/Checkout/Setup/InstallData.php delete mode 100644 app/code/Magento/Checkout/data/checkout_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Cms/Model/Resource/Setup.php rename app/code/Magento/Cms/{data/cms_setup/data-install-2.0.0.php => Setup/InstallData.php} (58%) create mode 100644 app/code/Magento/ConfigurableProduct/Setup/InstallData.php delete mode 100644 app/code/Magento/ConfigurableProduct/data/configurableproduct_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Customer/Model/Resource/Setup.php rename app/code/Magento/Customer/Setup/{Customer.php => CustomerSetup.php} (99%) delete mode 100644 app/code/Magento/Customer/data/customer_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Dhl/Model/Resource/Setup.php create mode 100644 app/code/Magento/Dhl/Setup/InstallData.php delete mode 100644 app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Directory/Model/Resource/Setup.php create mode 100644 app/code/Magento/Directory/Setup/InstallData.php delete mode 100644 app/code/Magento/Directory/data/directory_setup/data-install-2.0.0.php create mode 100644 app/code/Magento/Downloadable/Setup/InstallData.php delete mode 100644 app/code/Magento/Downloadable/data/downloadable_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Eav/Model/Entity/Setup.php rename app/code/Magento/Eav/Setup/{Eav.php => EavSetup.php} (99%) create mode 100644 app/code/Magento/Eav/Setup/InstallData.php delete mode 100644 app/code/Magento/Eav/data/eav_setup/data-upgrade-2.0.0.php delete mode 100644 app/code/Magento/GiftMessage/Model/Resource/Setup.php create mode 100644 app/code/Magento/GiftMessage/Setup/InstallData.php delete mode 100644 app/code/Magento/GiftMessage/data/giftmessage_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/GoogleShopping/Model/Resource/Setup.php delete mode 100644 app/code/Magento/GoogleShopping/data/googleshopping_setup/data-install-2.0.0.php create mode 100644 app/code/Magento/GroupedProduct/Setup/InstallData.php delete mode 100644 app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-2.0.0.php create mode 100644 app/code/Magento/Msrp/Setup/InstallData.php delete mode 100644 app/code/Magento/Msrp/data/msrp_setup/data-install-2.0.0.php create mode 100644 app/code/Magento/Quote/Setup/InstallData.php rename app/code/Magento/Quote/{Model/Resource/Setup.php => Setup/QuoteSetup.php} (71%) delete mode 100644 app/code/Magento/Quote/data/quote_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Reports/Model/Resource/Setup.php create mode 100644 app/code/Magento/Reports/Setup/InstallData.php delete mode 100644 app/code/Magento/Reports/data/reports_setup/data-install-2.0.0.php create mode 100644 app/code/Magento/Sales/Setup/InstallData.php rename app/code/Magento/Sales/{Model/Resource/Setup.php => Setup/SalesSetup.php} (76%) delete mode 100644 app/code/Magento/Sales/data/sales_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Tax/Model/Resource/Setup.php create mode 100644 app/code/Magento/Tax/Setup/InstallData.php create mode 100644 app/code/Magento/Tax/Setup/TaxSetup.php delete mode 100644 app/code/Magento/Tax/data/tax_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Theme/Model/Resource/Setup.php create mode 100644 app/code/Magento/Theme/Setup/InstallData.php delete mode 100644 app/code/Magento/Theme/data/theme_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Weee/Model/Resource/Setup.php create mode 100644 app/code/Magento/Weee/Setup/InstallData.php delete mode 100644 app/code/Magento/Weee/data/weee_setup/data-install-2.0.0.php rename dev/tests/unit/testsuite/Magento/Catalog/{Model/Resource/SetupTest.php => Setup/CategorySetupTest.php} (93%) rename dev/tests/unit/testsuite/Magento/Tax/{Model/Resource/SetupTest.php => Setup/TaxSetupTest.php} (84%) diff --git a/app/code/Magento/Authorization/Model/Resource/Setup.php b/app/code/Magento/Authorization/Setup/AuthorizationFactory.php similarity index 78% rename from app/code/Magento/Authorization/Model/Resource/Setup.php rename to app/code/Magento/Authorization/Setup/AuthorizationFactory.php index 451ee7114ea5d..8549c61b751e2 100644 --- a/app/code/Magento/Authorization/Model/Resource/Setup.php +++ b/app/code/Magento/Authorization/Setup/AuthorizationFactory.php @@ -3,8 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Authorization\Model\Resource; -use Magento\Framework\Setup\ModuleDataResourceInterface; +namespace Magento\Authorization\Setup; /** * Resource Setup Model @@ -12,7 +11,7 @@ * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Setup extends \Magento\Setup\Module\DataSetup +class AuthorizationFactory { /** * Role model factory @@ -43,30 +42,21 @@ class Setup extends \Magento\Setup\Module\DataSetup protected $_rulesFactory; /** - * @param \Magento\Framework\Module\Setup\Context $context - * @param string $resourceName * @param \Magento\Authorization\Model\Resource\Role\CollectionFactory $roleCollectionFactory * @param \Magento\Authorization\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory * @param \Magento\Authorization\Model\RoleFactory $roleFactory * @param \Magento\Authorization\Model\RulesFactory $rulesFactory - * @param string $moduleName - * @param string $connectionName */ public function __construct( - \Magento\Framework\Module\Setup\Context $context, - $resourceName, \Magento\Authorization\Model\Resource\Role\CollectionFactory $roleCollectionFactory, \Magento\Authorization\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory, \Magento\Authorization\Model\RoleFactory $roleFactory, - \Magento\Authorization\Model\RulesFactory $rulesFactory, - $moduleName = 'Magento_Authorization', - $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION + \Magento\Authorization\Model\RulesFactory $rulesFactory ) { $this->_roleCollectionFactory = $roleCollectionFactory; $this->_rulesCollectionFactory = $rulesCollectionFactory; $this->_roleFactory = $roleFactory; $this->_rulesFactory = $rulesFactory; - parent::__construct($context, $resourceName, $moduleName, $connectionName); } /** diff --git a/app/code/Magento/Authorization/Setup/InstallData.php b/app/code/Magento/Authorization/Setup/InstallData.php new file mode 100644 index 0000000000000..5e2e846fb6401 --- /dev/null +++ b/app/code/Magento/Authorization/Setup/InstallData.php @@ -0,0 +1,81 @@ +authFactory = $authFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + $roleCollection = $this->authFactory->createRoleCollection() + ->addFieldToFilter('parent_id', 0) + ->addFieldToFilter('tree_level', 1) + ->addFieldToFilter('role_type', RoleGroup::ROLE_TYPE) + ->addFieldToFilter('user_id', 0) + ->addFieldToFilter('user_type', UserContextInterface::USER_TYPE_ADMIN) + ->addFieldToFilter('role_name', 'Administrators'); + + if ($roleCollection->count() == 0) { + $admGroupRole = $this->authFactory->createRole()->setData( + [ + 'parent_id' => 0, + 'tree_level' => 1, + 'sort_order' => 1, + 'role_type' => RoleGroup::ROLE_TYPE, + 'user_id' => 0, + 'user_type' => UserContextInterface::USER_TYPE_ADMIN, + 'role_name' => 'Administrators', + ] + )->save(); + } else { + foreach ($roleCollection as $item) { + $admGroupRole = $item; + break; + } + } + + $rulesCollection = $this->authFactory->createRulesCollection() + ->addFieldToFilter('role_id', $admGroupRole->getId()) + ->addFieldToFilter('resource_id', 'all'); + + if ($rulesCollection->count() == 0) { + $this->authFactory->createRules()->setData( + [ + 'role_id' => $admGroupRole->getId(), + 'resource_id' => 'Magento_Adminhtml::all', + 'privileges' => null, + 'permission' => 'allow', + ] + )->save(); + } else { + /** @var \Magento\Authorization\Model\Rules $rule */ + foreach ($rulesCollection as $rule) { + $rule->setData('resource_id', 'Magento_Adminhtml::all')->save(); + } + } + } +} diff --git a/app/code/Magento/Authorization/data/authorization_setup/data-install-2.0.0.php b/app/code/Magento/Authorization/data/authorization_setup/data-install-2.0.0.php deleted file mode 100644 index 1e2f7b53f31a6..0000000000000 --- a/app/code/Magento/Authorization/data/authorization_setup/data-install-2.0.0.php +++ /dev/null @@ -1,60 +0,0 @@ -createRoleCollection() - ->addFieldToFilter('parent_id', 0) - ->addFieldToFilter('tree_level', 1) - ->addFieldToFilter('role_type', RoleGroup::ROLE_TYPE) - ->addFieldToFilter('user_id', 0) - ->addFieldToFilter('user_type', UserContextInterface::USER_TYPE_ADMIN) - ->addFieldToFilter('role_name', 'Administrators'); - -if ($roleCollection->count() == 0) { - $admGroupRole = $this->createRole()->setData( - [ - 'parent_id' => 0, - 'tree_level' => 1, - 'sort_order' => 1, - 'role_type' => RoleGroup::ROLE_TYPE, - 'user_id' => 0, - 'user_type' => UserContextInterface::USER_TYPE_ADMIN, - 'role_name' => 'Administrators', - ] - )->save(); -} else { - foreach ($roleCollection as $item) { - $admGroupRole = $item; - break; - } -} - -$rulesCollection = $this->createRulesCollection() - ->addFieldToFilter('role_id', $admGroupRole->getId()) - ->addFieldToFilter('resource_id', 'all'); - -if ($rulesCollection->count() == 0) { - $this->createRules()->setData( - [ - 'role_id' => $admGroupRole->getId(), - 'resource_id' => 'Magento_Adminhtml::all', - 'privileges' => null, - 'permission' => 'allow', - ] - )->save(); -} else { - /** @var \Magento\Authorization\Model\Rules $rule */ - foreach ($rulesCollection as $rule) { - $rule->setData('resource_id', 'Magento_Adminhtml::all')->save(); - } -} diff --git a/app/code/Magento/Authorization/etc/di.xml b/app/code/Magento/Authorization/etc/di.xml index 0ff8a20ef5bcb..9aa6661d1a820 100644 --- a/app/code/Magento/Authorization/etc/di.xml +++ b/app/code/Magento/Authorization/etc/di.xml @@ -13,13 +13,6 @@ Magento\Framework\Acl\Cache\Proxy - - - - Magento\Authorization\Model\Resource\Setup - - - Magento\Authorization\Model\Acl\Loader\Rule diff --git a/app/code/Magento/Bundle/Setup/InstallData.php b/app/code/Magento/Bundle/Setup/InstallData.php new file mode 100644 index 0000000000000..4ecb331f5a360 --- /dev/null +++ b/app/code/Magento/Bundle/Setup/InstallData.php @@ -0,0 +1,197 @@ +eavSetupFactory = $eavSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var EavSetup $eavSetup */ + $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); + $fieldList = [ + 'price', + 'special_price', + 'special_from_date', + 'special_to_date', + 'minimal_price', + 'cost', + 'tier_price', + 'weight', + 'group_price', + ]; + foreach ($fieldList as $field) { + $applyTo = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')); + if (!in_array('bundle', $applyTo)) { + $applyTo[] = 'bundle'; + $eavSetup->updateAttribute( + \Magento\Catalog\Model\Product::ENTITY, + $field, + 'apply_to', + implode(',', $applyTo) + ); + } + } + + $applyTo = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'cost', 'apply_to')); + unset($applyTo[array_search('bundle', $applyTo)]); + $eavSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'cost', 'apply_to', implode(',', $applyTo)); + + /** + * Add attributes to the eav/attribute + */ + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'price_type', + [ + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => '', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, + 'visible' => true, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'used_in_product_listing' => true, + 'unique' => false, + 'apply_to' => 'bundle' + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'sku_type', + [ + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => '', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'bundle' + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'weight_type', + [ + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => '', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'used_in_product_listing' => true, + 'unique' => false, + 'apply_to' => 'bundle' + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'price_view', + [ + 'group' => 'Advanced Pricing', + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => 'Price View', + 'input' => 'select', + 'class' => '', + 'source' => 'Magento\Bundle\Model\Product\Attribute\Source\Price\View', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, + 'visible' => true, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'used_in_product_listing' => true, + 'unique' => false, + 'apply_to' => 'bundle' + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'shipment_type', + [ + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => 'Shipment', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'used_in_product_listing' => true, + 'unique' => false, + 'apply_to' => 'bundle' + ] + ); + } +} diff --git a/app/code/Magento/Bundle/data/bundle_setup/data-install-2.0.0.php b/app/code/Magento/Bundle/data/bundle_setup/data-install-2.0.0.php deleted file mode 100644 index 4e19ae5f6fb60..0000000000000 --- a/app/code/Magento/Bundle/data/bundle_setup/data-install-2.0.0.php +++ /dev/null @@ -1,169 +0,0 @@ -getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')); - if (!in_array('bundle', $applyTo)) { - $applyTo[] = 'bundle'; - $installer->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - $field, - 'apply_to', - implode(',', $applyTo) - ); - } -} - -$applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'cost', 'apply_to')); -unset($applyTo[array_search('bundle', $applyTo)]); -$installer->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'cost', 'apply_to', implode(',', $applyTo)); - -/** - * Add attributes to the eav/attribute - */ -$installer->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'price_type', - [ - 'type' => 'int', - 'backend' => '', - 'frontend' => '', - 'label' => '', - 'input' => '', - 'class' => '', - 'source' => '', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, - 'visible' => true, - 'required' => true, - 'user_defined' => false, - 'default' => '', - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'used_in_product_listing' => true, - 'unique' => false, - 'apply_to' => 'bundle' - ] -); - -$installer->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'sku_type', - [ - 'type' => 'int', - 'backend' => '', - 'frontend' => '', - 'label' => '', - 'input' => '', - 'class' => '', - 'source' => '', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, - 'visible' => false, - 'required' => true, - 'user_defined' => false, - 'default' => '', - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'unique' => false, - 'apply_to' => 'bundle' - ] -); - -$installer->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'weight_type', - [ - 'type' => 'int', - 'backend' => '', - 'frontend' => '', - 'label' => '', - 'input' => '', - 'class' => '', - 'source' => '', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, - 'visible' => false, - 'required' => true, - 'user_defined' => false, - 'default' => '', - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'used_in_product_listing' => true, - 'unique' => false, - 'apply_to' => 'bundle' - ] -); - -$installer->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'price_view', - [ - 'group' => 'Advanced Pricing', - 'type' => 'int', - 'backend' => '', - 'frontend' => '', - 'label' => 'Price View', - 'input' => 'select', - 'class' => '', - 'source' => 'Magento\Bundle\Model\Product\Attribute\Source\Price\View', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, - 'visible' => true, - 'required' => true, - 'user_defined' => false, - 'default' => '', - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'used_in_product_listing' => true, - 'unique' => false, - 'apply_to' => 'bundle' - ] -); - -$installer->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'shipment_type', - [ - 'type' => 'int', - 'backend' => '', - 'frontend' => '', - 'label' => 'Shipment', - 'input' => '', - 'class' => '', - 'source' => '', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, - 'visible' => false, - 'required' => true, - 'user_defined' => false, - 'default' => '', - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'used_in_product_listing' => true, - 'unique' => false, - 'apply_to' => 'bundle' - ] -); diff --git a/app/code/Magento/Bundle/etc/di.xml b/app/code/Magento/Bundle/etc/di.xml index 6fc7c8bda4891..88501bd4d5997 100644 --- a/app/code/Magento/Bundle/etc/di.xml +++ b/app/code/Magento/Bundle/etc/di.xml @@ -23,13 +23,6 @@ - - - - Magento\Catalog\Model\Resource\Setup - - - diff --git a/app/code/Magento/Catalog/Model/Resource/Setup.php b/app/code/Magento/Catalog/Setup/CategorySetup.php similarity index 95% rename from app/code/Magento/Catalog/Model/Resource/Setup.php rename to app/code/Magento/Catalog/Setup/CategorySetup.php index e71ba40a33a0a..1e72337e8fa1c 100644 --- a/app/code/Magento/Catalog/Model/Resource/Setup.php +++ b/app/code/Magento/Catalog/Setup/CategorySetup.php @@ -5,56 +5,41 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Catalog\Model\Resource; +namespace Magento\Catalog\Setup; +use Magento\Catalog\Model\CategoryFactory; +use Magento\Catalog\Model\Resource\Eav\AttributeFactory; +use Magento\Eav\Model\Entity\Setup\Context; +use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; +use Magento\Eav\Setup\EavSetup; +use Magento\Framework\App\CacheInterface; use Magento\Framework\Setup\ModuleDataResourceInterface; -class Setup extends \Magento\Eav\Model\Entity\Setup +class CategorySetup extends EavSetup { /** * Category model factory * - * @var \Magento\Catalog\Model\CategoryFactory + * @var CategoryFactory */ - protected $_categoryFactory; + private $categoryFactory; /** - * Attribute resource model factory - * - * @var \Magento\Catalog\Model\Resource\Eav\AttributeFactory - */ - protected $_eavAttributeResourceFactory; - - /** - * @param \Magento\Eav\Model\Entity\Setup\Context $context - * @param string $resourceName - * @param \Magento\Framework\App\CacheInterface $cache - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory - * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param Eav\AttributeFactory $eavAttributeResourceFactory - * @param string $moduleName - * @param string $connectionName + * @param ModuleDataResourceInterface $setup + * @param Context $context + * @param CacheInterface $cache + * @param CollectionFactory $attrGroupCollectionFactory + * @param CategoryFactory $categoryFactory */ public function __construct( - \Magento\Eav\Model\Entity\Setup\Context $context, - $resourceName, - \Magento\Framework\App\CacheInterface $cache, - \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, - \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeResourceFactory, - $moduleName = 'Magento_Catalog', - $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION + ModuleDataResourceInterface $setup, + Context $context, + CacheInterface $cache, + CollectionFactory $attrGroupCollectionFactory, + CategoryFactory $categoryFactory ) { - $this->_categoryFactory = $categoryFactory; - $this->_eavAttributeResourceFactory = $eavAttributeResourceFactory; - parent::__construct( - $context, - $resourceName, - $cache, - $attrGroupCollectionFactory, - $moduleName, - $connectionName - ); + $this->categoryFactory = $categoryFactory; + parent::__construct($setup, $context, $cache, $attrGroupCollectionFactory); } /** @@ -66,11 +51,11 @@ public function __construct( */ public function createCategory($data = []) { - return $this->_categoryFactory->create($data); + return $this->categoryFactory->create($data); } /** - * Default entites and attributes + * Default entities and attributes * * @return array * @SuppressWarnings(PHPMD.ExcessiveMethodLength) diff --git a/app/code/Magento/Catalog/Setup/InstallData.php b/app/code/Magento/Catalog/Setup/InstallData.php new file mode 100644 index 0000000000000..8e0591334aba7 --- /dev/null +++ b/app/code/Magento/Catalog/Setup/InstallData.php @@ -0,0 +1,294 @@ +categorySetupFactory = $categorySetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */ + $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]); + + $categorySetup->installEntities(); + // Create Root Catalog Node + $categorySetup->createCategory() + ->load(1) + ->setId(1) + ->setStoreId(0) + ->setPath('1') + ->setLevel(0) + ->setPosition(0) + ->setChildrenCount(0) + ->setName('Root Catalog') + ->setInitialSetupFlag(true) + ->save(); + + $category = $categorySetup->createCategory(); + + $categorySetup->createCategory() + ->setStoreId(0) + ->setPath('1') + ->setName('Default Category') + ->setDisplayMode('PRODUCTS') + ->setAttributeSetId($category->getDefaultAttributeSetId()) + ->setIsActive(1) + ->setLevel(1) + ->setInitialSetupFlag(true) + ->save(); + + $data = [ + 'scope' => 'default', + 'scope_id' => 0, + 'path' => \Magento\Catalog\Helper\Category::XML_PATH_CATEGORY_ROOT_ID, + 'value' => $category->getId(), + ]; + $setup->getConnection() + ->insertOnDuplicate($setup->getTable('core_config_data'), $data, ['value']); + + $categorySetup->addAttributeGroup(\Magento\Catalog\Model\Product::ENTITY, 'Default', 'Design', 6); + + $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Category::ENTITY); + $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId); + $attributeGroupId = $categorySetup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); + + // update General Group + $categorySetup->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'sort_order', '10'); + + $groups = [ + 'display' => ['name' => 'Display Settings', 'sort' => 20, 'id' => null], + 'design' => ['name' => 'Custom Design', 'sort' => 30, 'id' => null], + ]; + + foreach ($groups as $k => $groupProp) { + $categorySetup->addAttributeGroup($entityTypeId, $attributeSetId, $groupProp['name'], $groupProp['sort']); + $groups[$k]['id'] = $categorySetup->getAttributeGroupId($entityTypeId, $attributeSetId, $groupProp['name']); + } + + // update attributes group and sort + $attributes = [ + 'custom_design' => ['group' => 'design', 'sort' => 10], + // 'custom_design_apply' => array('group' => 'design', 'sort' => 20), + 'custom_design_from' => ['group' => 'design', 'sort' => 30], + 'custom_design_to' => ['group' => 'design', 'sort' => 40], + 'page_layout' => ['group' => 'design', 'sort' => 50], + 'custom_layout_update' => ['group' => 'design', 'sort' => 60], + 'display_mode' => ['group' => 'display', 'sort' => 10], + 'landing_page' => ['group' => 'display', 'sort' => 20], + 'is_anchor' => ['group' => 'display', 'sort' => 30], + 'available_sort_by' => ['group' => 'display', 'sort' => 40], + 'default_sort_by' => ['group' => 'display', 'sort' => 50], + ]; + + foreach ($attributes as $attributeCode => $attributeProp) { + $categorySetup->addAttributeToGroup( + $entityTypeId, + $attributeSetId, + $groups[$attributeProp['group']]['id'], + $attributeCode, + $attributeProp['sort'] + ); + } + + /** + * Install product link types + */ + $data = [ + ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, 'code' => 'relation'], + ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, 'code' => 'up_sell'], + ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, 'code' => 'cross_sell'], + ]; + + foreach ($data as $bind) { + $setup->getConnection() + ->insertForce($setup->getTable('catalog_product_link_type'), $bind); + } + + /** + * install product link attributes + */ + $data = [ + [ + 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, + 'product_link_attribute_code' => 'position', + 'data_type' => 'int', + ], + [ + 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, + 'product_link_attribute_code' => 'position', + 'data_type' => 'int' + ], + [ + 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, + 'product_link_attribute_code' => 'position', + 'data_type' => 'int' + ], + ]; + + $setup->getConnection() + ->insertMultiple($setup->getTable('catalog_product_link_attribute'), $data); + + /** + * Remove Catalog specified attribute options (columns) from eav/attribute table + * + */ + $describe = $setup->getConnection() + ->describeTable($setup->getTable('catalog_eav_attribute')); + foreach ($describe as $columnData) { + if ($columnData['COLUMN_NAME'] == 'attribute_id') { + continue; + } + $setup->getConnection() + ->dropColumn($setup->getTable('eav_attribute'), $columnData['COLUMN_NAME']); + } + + $newGeneralTabName = 'Product Details'; + $newPriceTabName = 'Advanced Pricing'; + $newImagesTabName = 'Image Management'; + $newMetaTabName = 'Search Engine Optimization'; + $autosettingsTabName = 'Autosettings'; + $tabNames = [ + 'General' => [ + 'attribute_group_name' => $newGeneralTabName, + 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newGeneralTabName)), + 'tab_group_code' => 'basic', + 'sort_order' => 10, + ], + 'Images' => [ + 'attribute_group_name' => $newImagesTabName, + 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newImagesTabName)), + 'tab_group_code' => 'basic', + 'sort_order' => 20, + ], + 'Meta Information' => [ + 'attribute_group_name' => $newMetaTabName, + 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newMetaTabName)), + 'tab_group_code' => 'basic', + 'sort_order' => 30, + ], + 'Prices' => [ + 'attribute_group_name' => $newPriceTabName, + 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newPriceTabName)), + 'tab_group_code' => 'advanced', + 'sort_order' => 40, + ], + 'Design' => ['attribute_group_code' => 'design', 'tab_group_code' => 'advanced', 'sort_order' => 50], + ]; + + $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); + $attributeSetId = $categorySetup->getAttributeSetId($entityTypeId, 'Default'); + + //Rename attribute tabs + foreach ($tabNames as $tabName => $tab) { + $groupId = $categorySetup->getAttributeGroupId($entityTypeId, $attributeSetId, $tabName); + if ($groupId) { + foreach ($tab as $propertyName => $propertyValue) { + $categorySetup->updateAttributeGroup( + $entityTypeId, + $attributeSetId, + $groupId, + $propertyName, + $propertyValue + ); + } + } + } + + //Add new tab + $categorySetup->addAttributeGroup($entityTypeId, $attributeSetId, $autosettingsTabName, 60); + $categorySetup->updateAttributeGroup( + $entityTypeId, + $attributeSetId, + 'Autosettings', + 'attribute_group_code', + 'autosettings' + ); + $categorySetup->updateAttributeGroup( + $entityTypeId, + $attributeSetId, + 'Autosettings', + 'tab_group_code', + 'advanced' + ); + + //New attributes order and properties + $properties = ['is_required', 'default_value', 'frontend_input_renderer']; + $attributesOrder = [ + //Product Details tab + 'name' => [$newGeneralTabName => 10], + 'sku' => [$newGeneralTabName => 20], + 'price' => [$newGeneralTabName => 30], + 'image' => [$newGeneralTabName => 50], + 'weight' => [$newGeneralTabName => 70, 'is_required' => 0], + 'category_ids' => [$newGeneralTabName => 80], + 'description' => [$newGeneralTabName => 90, 'is_required' => 0], + 'status' => [ + $newGeneralTabName => 100, + 'is_required' => 0, + 'default_value' => 1, + 'frontend_input_renderer' => 'Magento\Framework\Data\Form\Element\Hidden', + ], + //Autosettings tab + 'short_description' => [$autosettingsTabName => 0, 'is_required' => 0], + 'visibility' => [$autosettingsTabName => 20, 'is_required' => 0], + 'news_from_date' => [$autosettingsTabName => 30], + 'news_to_date' => [$autosettingsTabName => 40], + 'country_of_manufacture' => [$autosettingsTabName => 50], + ]; + + foreach ($attributesOrder as $key => $value) { + $attribute = $categorySetup->getAttribute($entityTypeId, $key); + if ($attribute) { + foreach ($value as $propertyName => $propertyValue) { + if (in_array($propertyName, $properties)) { + $categorySetup->updateAttribute( + $entityTypeId, + $attribute['attribute_id'], + $propertyName, + $propertyValue + ); + } else { + $categorySetup->addAttributeToGroup( + $entityTypeId, + $attributeSetId, + $propertyName, + $attribute['attribute_id'], + $propertyValue + ); + } + } + } + } + + foreach (['status', 'visibility'] as $attributeCode) { + $categorySetup->updateAttribute( + \Magento\Catalog\Model\Product::ENTITY, + $attributeCode, + 'is_required_in_admin_store', + '1' + ); + } + } +} diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-install-2.0.0.php b/app/code/Magento/Catalog/data/catalog_setup/data-install-2.0.0.php deleted file mode 100644 index 5ffc87091e5b2..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-install-2.0.0.php +++ /dev/null @@ -1,252 +0,0 @@ -installEntities(); -// Create Root Catalog Node -$installer->createCategory() - ->load(1) - ->setId(1) - ->setStoreId(0) - ->setPath('1') - ->setLevel(0) - ->setPosition(0) - ->setChildrenCount(0) - ->setName('Root Catalog') - ->setInitialSetupFlag(true) - ->save(); - -$category = $installer->createCategory(); - -$installer->createCategory() - ->setStoreId(0) - ->setPath('1') - ->setName('Default Category') - ->setDisplayMode('PRODUCTS') - ->setAttributeSetId($category->getDefaultAttributeSetId()) - ->setIsActive(1) - ->setLevel(1) - ->setInitialSetupFlag(true) - ->save(); - -$data = [ - 'scope' => 'default', - 'scope_id' => 0, - 'path' => \Magento\Catalog\Helper\Category::XML_PATH_CATEGORY_ROOT_ID, - 'value' => $category->getId(), -]; -$installer->getConnection() - ->insertOnDuplicate($installer->getTable('core_config_data'), $data, ['value']); - -$installer->addAttributeGroup(\Magento\Catalog\Model\Product::ENTITY, 'Default', 'Design', 6); - -$entityTypeId = $installer->getEntityTypeId(\Magento\Catalog\Model\Category::ENTITY); -$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId); -$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); - -// update General Group -//$installer->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'attribute_group_name', 'General Information'); -$installer->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'sort_order', '10'); - -$groups = [ - 'display' => ['name' => 'Display Settings', 'sort' => 20, 'id' => null], - 'design' => ['name' => 'Custom Design', 'sort' => 30, 'id' => null], -]; - -foreach ($groups as $k => $groupProp) { - $installer->addAttributeGroup($entityTypeId, $attributeSetId, $groupProp['name'], $groupProp['sort']); - $groups[$k]['id'] = $installer->getAttributeGroupId($entityTypeId, $attributeSetId, $groupProp['name']); -} - -// update attributes group and sort -$attributes = [ - 'custom_design' => ['group' => 'design', 'sort' => 10], - // 'custom_design_apply' => array('group' => 'design', 'sort' => 20), - 'custom_design_from' => ['group' => 'design', 'sort' => 30], - 'custom_design_to' => ['group' => 'design', 'sort' => 40], - 'page_layout' => ['group' => 'design', 'sort' => 50], - 'custom_layout_update' => ['group' => 'design', 'sort' => 60], - 'display_mode' => ['group' => 'display', 'sort' => 10], - 'landing_page' => ['group' => 'display', 'sort' => 20], - 'is_anchor' => ['group' => 'display', 'sort' => 30], - 'available_sort_by' => ['group' => 'display', 'sort' => 40], - 'default_sort_by' => ['group' => 'display', 'sort' => 50], -]; - -foreach ($attributes as $attributeCode => $attributeProp) { - $installer->addAttributeToGroup( - $entityTypeId, - $attributeSetId, - $groups[$attributeProp['group']]['id'], - $attributeCode, - $attributeProp['sort'] - ); -} - -/** - * Install product link types - */ -$data = [ - ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, 'code' => 'relation'], - ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, 'code' => 'up_sell'], - ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, 'code' => 'cross_sell'], -]; - -foreach ($data as $bind) { - $installer->getConnection() - ->insertForce($installer->getTable('catalog_product_link_type'), $bind); -} - -/** - * install product link attributes - */ -$data = [ - [ - 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, - 'product_link_attribute_code' => 'position', - 'data_type' => 'int', - ], - [ - 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, - 'product_link_attribute_code' => 'position', - 'data_type' => 'int' - ], - [ - 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, - 'product_link_attribute_code' => 'position', - 'data_type' => 'int' - ], -]; - -$installer->getConnection() - ->insertMultiple($installer->getTable('catalog_product_link_attribute'), $data); - -/** - * Remove Catalog specified attribute options (columns) from eav/attribute table - * - */ -$describe = $installer->getConnection() - ->describeTable($installer->getTable('catalog_eav_attribute')); -foreach ($describe as $columnData) { - if ($columnData['COLUMN_NAME'] == 'attribute_id') { - continue; - } - $installer->getConnection() - ->dropColumn($installer->getTable('eav_attribute'), $columnData['COLUMN_NAME']); -} - -$newGeneralTabName = 'Product Details'; -$newPriceTabName = 'Advanced Pricing'; -$newImagesTabName = 'Image Management'; -$newMetaTabName = 'Search Engine Optimization'; -$autosettingsTabName = 'Autosettings'; -$tabNames = [ - 'General' => [ - 'attribute_group_name' => $newGeneralTabName, - 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newGeneralTabName)), - 'tab_group_code' => 'basic', - 'sort_order' => 10, - ], - 'Images' => [ - 'attribute_group_name' => $newImagesTabName, - 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newImagesTabName)), - 'tab_group_code' => 'basic', - 'sort_order' => 20, - ], - 'Meta Information' => [ - 'attribute_group_name' => $newMetaTabName, - 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newMetaTabName)), - 'tab_group_code' => 'basic', - 'sort_order' => 30, - ], - 'Prices' => [ - 'attribute_group_name' => $newPriceTabName, - 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newPriceTabName)), - 'tab_group_code' => 'advanced', - 'sort_order' => 40, - ], - 'Design' => ['attribute_group_code' => 'design', 'tab_group_code' => 'advanced', 'sort_order' => 50], -]; - -$entityTypeId = $installer->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); -$attributeSetId = $installer->getAttributeSetId($entityTypeId, 'Default'); - -//Rename attribute tabs -foreach ($tabNames as $tabName => $tab) { - $groupId = $installer->getAttributeGroupId($entityTypeId, $attributeSetId, $tabName); - if ($groupId) { - foreach ($tab as $propertyName => $propertyValue) { - $installer->updateAttributeGroup($entityTypeId, $attributeSetId, $groupId, $propertyName, $propertyValue); - } - } -} - -//Add new tab -$installer->addAttributeGroup($entityTypeId, $attributeSetId, $autosettingsTabName, 60); -$installer->updateAttributeGroup( - $entityTypeId, - $attributeSetId, - 'Autosettings', - 'attribute_group_code', - 'autosettings' -); -$installer->updateAttributeGroup($entityTypeId, $attributeSetId, 'Autosettings', 'tab_group_code', 'advanced'); - -//New attributes order and properties -$properties = ['is_required', 'default_value', 'frontend_input_renderer']; -$attributesOrder = [ - //Product Details tab - 'name' => [$newGeneralTabName => 10], - 'sku' => [$newGeneralTabName => 20], - 'price' => [$newGeneralTabName => 30], - 'image' => [$newGeneralTabName => 50], - 'weight' => [$newGeneralTabName => 70, 'is_required' => 0], - 'category_ids' => [$newGeneralTabName => 80], - 'description' => [$newGeneralTabName => 90, 'is_required' => 0], - 'status' => [ - $newGeneralTabName => 100, - 'is_required' => 0, - 'default_value' => 1, - 'frontend_input_renderer' => 'Magento\Framework\Data\Form\Element\Hidden', - ], - //Autosettings tab - 'short_description' => [$autosettingsTabName => 0, 'is_required' => 0], - 'visibility' => [$autosettingsTabName => 20, 'is_required' => 0], - 'news_from_date' => [$autosettingsTabName => 30], - 'news_to_date' => [$autosettingsTabName => 40], - 'country_of_manufacture' => [$autosettingsTabName => 50], -]; - -foreach ($attributesOrder as $key => $value) { - $attribute = $installer->getAttribute($entityTypeId, $key); - if ($attribute) { - foreach ($value as $propertyName => $propertyValue) { - if (in_array($propertyName, $properties)) { - $installer->updateAttribute($entityTypeId, $attribute['attribute_id'], $propertyName, $propertyValue); - } else { - $installer->addAttributeToGroup( - $entityTypeId, - $attributeSetId, - $propertyName, - $attribute['attribute_id'], - $propertyValue - ); - } - } - } -} - -foreach (['status', 'visibility'] as $attributeCode) { - $installer->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - $attributeCode, - 'is_required_in_admin_store', - '1' - ); -} diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 148e9aeef5ecf..6b4a7b07e73f9 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -135,13 +135,6 @@ 5,10,15,20,25 - - - - Magento\Catalog\Model\Resource\Setup - - - Magento\Customer\Model\Session\Proxy diff --git a/app/code/Magento/CatalogInventory/Setup/InstallData.php b/app/code/Magento/CatalogInventory/Setup/InstallData.php new file mode 100644 index 0000000000000..f5886665adb6f --- /dev/null +++ b/app/code/Magento/CatalogInventory/Setup/InstallData.php @@ -0,0 +1,52 @@ +eavSetupFactory = $eavSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + $setup->getConnection() + ->insertForce( + $setup->getTable('cataloginventory_stock'), + ['stock_id' => 1, 'stock_name' => 'Default'] + ); + + /** @var EavSetup $eavSetup */ + $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); + $groupName = 'Product Details'; + $entityTypeId = $eavSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); + $attributeSetId = $eavSetup->getAttributeSetId($entityTypeId, 'Default'); + + $attribute = $eavSetup->getAttribute($entityTypeId, 'quantity_and_stock_status'); + if ($attribute) { + $eavSetup->addAttributeToGroup($entityTypeId, $attributeSetId, $groupName, $attribute['attribute_id'], 60); + $eavSetup->updateAttribute($entityTypeId, $attribute['attribute_id'], 'default_value', 1); + } + } +} diff --git a/app/code/Magento/CatalogInventory/data/cataloginventory_setup/data-install-2.0.0.php b/app/code/Magento/CatalogInventory/data/cataloginventory_setup/data-install-2.0.0.php deleted file mode 100644 index 70a49438d9ba0..0000000000000 --- a/app/code/Magento/CatalogInventory/data/cataloginventory_setup/data-install-2.0.0.php +++ /dev/null @@ -1,26 +0,0 @@ -getConnection() - ->insertForce( - $installer->getTable('cataloginventory_stock'), - ['stock_id' => 1, 'stock_name' => 'Default'] - ); - -/** @var $this \Magento\Catalog\Model\Resource\Setup */ - -$groupName = 'Product Details'; -$entityTypeId = $this->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); -$attributeSetId = $this->getAttributeSetId($entityTypeId, 'Default'); - -$attribute = $this->getAttribute($entityTypeId, 'quantity_and_stock_status'); -if ($attribute) { - $this->addAttributeToGroup($entityTypeId, $attributeSetId, $groupName, $attribute['attribute_id'], 60); - $this->updateAttribute($entityTypeId, $attribute['attribute_id'], 'default_value', 1); -} diff --git a/app/code/Magento/CatalogInventory/etc/di.xml b/app/code/Magento/CatalogInventory/etc/di.xml index b689be3a1cc8a..2535e60098d0a 100644 --- a/app/code/Magento/CatalogInventory/etc/di.xml +++ b/app/code/Magento/CatalogInventory/etc/di.xml @@ -36,13 +36,6 @@ Magento\CatalogInventory\Model\Resource\Stock\Proxy - - - - Magento\Eav\Model\Entity\Setup - - - diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php new file mode 100644 index 0000000000000..63efb0e697fb3 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php @@ -0,0 +1,90 @@ +eavSetupFactory = $eavSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var EavSetup $eavSetup */ + $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); + $eavSetup->addAttribute( + \Magento\Catalog\Model\Category::ENTITY, + 'url_key', + [ + 'type' => 'varchar', + 'label' => 'URL Key', + 'input' => 'text', + 'required' => false, + 'sort_order' => 3, + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, + 'group' => 'General Information', + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Category::ENTITY, + 'url_path', + [ + 'type' => 'varchar', + 'required' => false, + 'sort_order' => 17, + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, + 'visible' => false, + 'group' => 'General Information', + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'url_key', + [ + 'type' => 'varchar', + 'label' => 'URL Key', + 'input' => 'text', + 'required' => false, + 'sort_order' => 10, + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, + 'used_in_product_listing' => true, + 'group' => 'Search Engine Optimization', + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'url_path', + [ + 'type' => 'varchar', + 'required' => false, + 'sort_order' => 11, + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, + 'visible' => false, + ] + ); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/data/catalogurlrewrite_setup/data-install-2.0.0.php b/app/code/Magento/CatalogUrlRewrite/data/catalogurlrewrite_setup/data-install-2.0.0.php deleted file mode 100644 index 127d4cbbaae5c..0000000000000 --- a/app/code/Magento/CatalogUrlRewrite/data/catalogurlrewrite_setup/data-install-2.0.0.php +++ /dev/null @@ -1,60 +0,0 @@ -addAttribute( - \Magento\Catalog\Model\Category::ENTITY, - 'url_key', - [ - 'type' => 'varchar', - 'label' => 'URL Key', - 'input' => 'text', - 'required' => false, - 'sort_order' => 3, - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'group' => 'General Information', - ] -); - -$this->addAttribute( - \Magento\Catalog\Model\Category::ENTITY, - 'url_path', - [ - 'type' => 'varchar', - 'required' => false, - 'sort_order' => 17, - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'visible' => false, - 'group' => 'General Information', - ] -); - -$this->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'url_key', - [ - 'type' => 'varchar', - 'label' => 'URL Key', - 'input' => 'text', - 'required' => false, - 'sort_order' => 10, - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'used_in_product_listing' => true, - 'group' => 'Search Engine Optimization', - ] -); - -$this->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'url_path', - [ - 'type' => 'varchar', - 'required' => false, - 'sort_order' => 11, - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'visible' => false, - ] -); diff --git a/app/code/Magento/CatalogUrlRewrite/etc/di.xml b/app/code/Magento/CatalogUrlRewrite/etc/di.xml index 668091f2a7ef3..f30bfcbfb4aed 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/di.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/di.xml @@ -16,11 +16,4 @@ Magento\CatalogUrlRewrite\Model\Storage\DbStorage - - - - Magento\Catalog\Model\Resource\Setup - - - diff --git a/app/code/Magento/Checkout/Model/Resource/Setup.php b/app/code/Magento/Checkout/Model/Resource/Setup.php deleted file mode 100644 index 88b81a9a2b793..0000000000000 --- a/app/code/Magento/Checkout/Model/Resource/Setup.php +++ /dev/null @@ -1,55 +0,0 @@ -_customerAddress = $customerAddress; - parent::__construct( - $context, - $resourceName, - $cache, - $attrGroupCollectionFactory, - $moduleName, - $connectionName - ); - } - - /** - * @return \Magento\Customer\Helper\Address - */ - public function getCustomerAddress() - { - return $this->_customerAddress; - } -} diff --git a/app/code/Magento/Checkout/Setup/InstallData.php b/app/code/Magento/Checkout/Setup/InstallData.php new file mode 100644 index 0000000000000..5ffc247d1c902 --- /dev/null +++ b/app/code/Magento/Checkout/Setup/InstallData.php @@ -0,0 +1,811 @@ +eavSetupFactory = $eavSetupFactory; + $this->customerAddress = $customerAddress; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var CustomerAddress $eavSetup */ + $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); + + $setup->startSetup(); + + $connection = $setup->getConnection(); + + $select = $connection->select()->from( + $setup->getTable('core_config_data'), + 'COUNT(*)' + )->where( + 'path=?', + 'customer/address/prefix_show' + )->where( + 'value NOT LIKE ?', + '0' + ); + $showPrefix = (bool)$this->customerAddress->getConfig('prefix_show') + || $connection->fetchOne($select) > 0; + + $select = $connection->select()->from( + $setup->getTable('core_config_data'), + 'COUNT(*)' + )->where( + 'path=?', + 'customer/address/middlename_show' + )->where( + 'value NOT LIKE ?', + '0' + ); + $showMiddlename = (bool)$this->customerAddress->getConfig( + 'middlename_show' + ) || $connection->fetchOne( + $select + ) > 0; + + $select = $connection->select()->from( + $setup->getTable('core_config_data'), + 'COUNT(*)' + )->where( + 'path=?', + 'customer/address/suffix_show' + )->where( + 'value NOT LIKE ?', + '0' + ); + $showSuffix = (bool)$this->customerAddress->getConfig('suffix_show') + || $connection->fetchOne($select) > 0; + + $select = $connection->select()->from( + $setup->getTable('core_config_data'), + 'COUNT(*)' + )->where( + 'path=?', + 'customer/address/dob_show' + )->where( + 'value NOT LIKE ?', + '0' + ); + $showDob = (bool)$this->customerAddress->getConfig('dob_show') + || $connection->fetchOne($select) > 0; + + $select = $connection->select()->from( + $setup->getTable('core_config_data'), + 'COUNT(*)' + )->where( + 'path=?', + 'customer/address/taxvat_show' + )->where( + 'value NOT LIKE ?', + '0' + ); + $showTaxVat = (bool)$this->customerAddress->getConfig('taxvat_show') + || $connection->fetchOne($select) > 0; + + $customerEntityTypeId = $eavSetup->getEntityTypeId('customer'); + $addressEntityTypeId = $eavSetup->getEntityTypeId('customer_address'); + + /** + ***************************************************************************** + * checkout/onepage/register + ***************************************************************************** + */ + + $connection->insert( + $setup->getTable('eav_form_type'), + [ + 'code' => 'checkout_onepage_register', + 'label' => 'checkout_onepage_register', + 'is_system' => 1, + 'theme' => '', + 'store_id' => 0 + ] + ); + $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type')); + + $connection->insert( + $setup->getTable('eav_form_type_entity'), + ['type_id' => $formTypeId, 'entity_type_id' => $customerEntityTypeId] + ); + $connection->insert( + $setup->getTable('eav_form_type_entity'), + ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId] + ); + + $elementSort = 0; + if ($showPrefix) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'), + 'sort_order' => $elementSort++ + ] + ); + if ($showMiddlename) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'), + 'sort_order' => $elementSort++ + ] + ); + if ($showSuffix) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'email'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'), + 'sort_order' => $elementSort++ + ] + ); + if ($showDob) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'dob'), + 'sort_order' => $elementSort++ + ] + ); + } + if ($showTaxVat) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'taxvat'), + 'sort_order' => $elementSort++ + ] + ); + } + + /** + ***************************************************************************** + * checkout/onepage/register_guest + ***************************************************************************** + */ + + $connection->insert( + $setup->getTable('eav_form_type'), + [ + 'code' => 'checkout_onepage_register_guest', + 'label' => 'checkout_onepage_register_guest', + 'is_system' => 1, + 'theme' => '', + 'store_id' => 0 + ] + ); + $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type')); + + $connection->insert( + $setup->getTable('eav_form_type_entity'), + ['type_id' => $formTypeId, 'entity_type_id' => $customerEntityTypeId] + ); + $connection->insert( + $setup->getTable('eav_form_type_entity'), + ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId] + ); + + $elementSort = 0; + if ($showPrefix) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'), + 'sort_order' => $elementSort++ + ] + ); + if ($showMiddlename) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'), + 'sort_order' => $elementSort++ + ] + ); + if ($showSuffix) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'email'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'), + 'sort_order' => $elementSort++ + ] + ); + if ($showDob) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'dob'), + 'sort_order' => $elementSort++ + ] + ); + } + if ($showTaxVat) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'taxvat'), + 'sort_order' => $elementSort++ + ] + ); + } + + /** + ***************************************************************************** + * checkout/onepage/billing_address + ***************************************************************************** + */ + + $connection->insert( + $setup->getTable('eav_form_type'), + [ + 'code' => 'checkout_onepage_billing_address', + 'label' => 'checkout_onepage_billing_address', + 'is_system' => 1, + 'theme' => '', + 'store_id' => 0 + ] + ); + $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type')); + + $connection->insert( + $setup->getTable('eav_form_type_entity'), + ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId] + ); + + $elementSort = 0; + if ($showPrefix) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'), + 'sort_order' => $elementSort++ + ] + ); + if ($showMiddlename) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'), + 'sort_order' => $elementSort++ + ] + ); + if ($showSuffix) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'), + 'sort_order' => $elementSort++ + ] + ); + + /** + ***************************************************************************** + * checkout/onepage/shipping_address + ***************************************************************************** + */ + + $connection->insert( + $setup->getTable('eav_form_type'), + [ + 'code' => 'checkout_onepage_shipping_address', + 'label' => 'checkout_onepage_shipping_address', + 'is_system' => 1, + 'theme' => '', + 'store_id' => 0 + ] + ); + $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type')); + + $connection->insert( + $setup->getTable('eav_form_type_entity'), + ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId] + ); + + $elementSort = 0; + if ($showPrefix) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'), + 'sort_order' => $elementSort++ + ] + ); + if ($showMiddlename) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'), + 'sort_order' => $elementSort++ + ] + ); + if ($showSuffix) { + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'), + 'sort_order' => $elementSort++ + ] + ); + } + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'), + 'sort_order' => $elementSort++ + ] + ); + $connection->insert( + $setup->getTable('eav_form_element'), + [ + 'type_id' => $formTypeId, + 'fieldset_id' => null, + 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'), + 'sort_order' => $elementSort++ + ] + ); + + $table = $setup->getTable('core_config_data'); + + $select = $connection->select()->from( + $table, + ['config_id', 'value'] + )->where( + 'path = ?', + 'checkout/options/onepage_checkout_disabled' + ); + + $data = $connection->fetchAll($select); + + if ($data) { + try { + $connection->beginTransaction(); + + foreach ($data as $value) { + $bind = ['path' => 'checkout/options/onepage_checkout_enabled', 'value' => !(bool)$value['value']]; + $where = 'config_id = ' . $value['config_id']; + $connection->update($table, $bind, $where); + } + + $connection->commit(); + } catch (\Exception $e) { + $connection->rollback(); + throw $e; + } + } + + $setup->endSetup(); + } +} diff --git a/app/code/Magento/Checkout/data/checkout_setup/data-install-2.0.0.php b/app/code/Magento/Checkout/data/checkout_setup/data-install-2.0.0.php deleted file mode 100644 index 79672896b74af..0000000000000 --- a/app/code/Magento/Checkout/data/checkout_setup/data-install-2.0.0.php +++ /dev/null @@ -1,772 +0,0 @@ -startSetup(); - -$setup = $installer->getConnection(); - -$select = $setup->select()->from( - $installer->getTable('core_config_data'), - 'COUNT(*)' -)->where( - 'path=?', - 'customer/address/prefix_show' -)->where( - 'value NOT LIKE ?', - '0' -); -$showPrefix = (bool)$installer->getCustomerAddress()->getConfig('prefix_show') || $setup->fetchOne($select) > 0; - -$select = $setup->select()->from( - $installer->getTable('core_config_data'), - 'COUNT(*)' -)->where( - 'path=?', - 'customer/address/middlename_show' -)->where( - 'value NOT LIKE ?', - '0' -); -$showMiddlename = (bool)$installer->getCustomerAddress()->getConfig( - 'middlename_show' -) || $setup->fetchOne( - $select -) > 0; - -$select = $setup->select()->from( - $installer->getTable('core_config_data'), - 'COUNT(*)' -)->where( - 'path=?', - 'customer/address/suffix_show' -)->where( - 'value NOT LIKE ?', - '0' -); -$showSuffix = (bool)$installer->getCustomerAddress()->getConfig('suffix_show') || $setup->fetchOne($select) > 0; - -$select = $setup->select()->from( - $installer->getTable('core_config_data'), - 'COUNT(*)' -)->where( - 'path=?', - 'customer/address/dob_show' -)->where( - 'value NOT LIKE ?', - '0' -); -$showDob = (bool)$installer->getCustomerAddress()->getConfig('dob_show') || $setup->fetchOne($select) > 0; - -$select = $setup->select()->from( - $installer->getTable('core_config_data'), - 'COUNT(*)' -)->where( - 'path=?', - 'customer/address/taxvat_show' -)->where( - 'value NOT LIKE ?', - '0' -); -$showTaxVat = (bool)$installer->getCustomerAddress()->getConfig('taxvat_show') || $setup->fetchOne($select) > 0; - -$customerEntityTypeId = $installer->getEntityTypeId('customer'); -$addressEntityTypeId = $installer->getEntityTypeId('customer_address'); - -/** - ***************************************************************************** - * checkout/onepage/register - ***************************************************************************** - */ - -$setup->insert( - $installer->getTable('eav_form_type'), - [ - 'code' => 'checkout_onepage_register', - 'label' => 'checkout_onepage_register', - 'is_system' => 1, - 'theme' => '', - 'store_id' => 0 - ] -); -$formTypeId = $setup->lastInsertId($installer->getTable('eav_form_type')); - -$setup->insert( - $installer->getTable('eav_form_type_entity'), - ['type_id' => $formTypeId, 'entity_type_id' => $customerEntityTypeId] -); -$setup->insert( - $installer->getTable('eav_form_type_entity'), - ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId] -); - -$elementSort = 0; -if ($showPrefix) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'prefix'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'firstname'), - 'sort_order' => $elementSort++ - ] -); -if ($showMiddlename) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'middlename'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'lastname'), - 'sort_order' => $elementSort++ - ] -); -if ($showSuffix) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'suffix'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'company'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'email'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'street'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'city'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'region'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'postcode'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'country_id'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'telephone'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'fax'), - 'sort_order' => $elementSort++ - ] -); -if ($showDob) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'dob'), - 'sort_order' => $elementSort++ - ] - ); -} -if ($showTaxVat) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'taxvat'), - 'sort_order' => $elementSort++ - ] - ); -} - -/** - ***************************************************************************** - * checkout/onepage/register_guest - ***************************************************************************** - */ - -$setup->insert( - $installer->getTable('eav_form_type'), - [ - 'code' => 'checkout_onepage_register_guest', - 'label' => 'checkout_onepage_register_guest', - 'is_system' => 1, - 'theme' => '', - 'store_id' => 0 - ] -); -$formTypeId = $setup->lastInsertId($installer->getTable('eav_form_type')); - -$setup->insert( - $installer->getTable('eav_form_type_entity'), - ['type_id' => $formTypeId, 'entity_type_id' => $customerEntityTypeId] -); -$setup->insert( - $installer->getTable('eav_form_type_entity'), - ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId] -); - -$elementSort = 0; -if ($showPrefix) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'prefix'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'firstname'), - 'sort_order' => $elementSort++ - ] -); -if ($showMiddlename) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'middlename'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'lastname'), - 'sort_order' => $elementSort++ - ] -); -if ($showSuffix) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'suffix'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'company'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'email'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'street'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'city'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'region'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'postcode'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'country_id'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'telephone'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'fax'), - 'sort_order' => $elementSort++ - ] -); -if ($showDob) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'dob'), - 'sort_order' => $elementSort++ - ] - ); -} -if ($showTaxVat) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'taxvat'), - 'sort_order' => $elementSort++ - ] - ); -} - -/** - ***************************************************************************** - * checkout/onepage/billing_address - ***************************************************************************** - */ - -$setup->insert( - $installer->getTable('eav_form_type'), - [ - 'code' => 'checkout_onepage_billing_address', - 'label' => 'checkout_onepage_billing_address', - 'is_system' => 1, - 'theme' => '', - 'store_id' => 0 - ] -); -$formTypeId = $setup->lastInsertId($installer->getTable('eav_form_type')); - -$setup->insert( - $installer->getTable('eav_form_type_entity'), - ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId] -); - -$elementSort = 0; -if ($showPrefix) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'prefix'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'firstname'), - 'sort_order' => $elementSort++ - ] -); -if ($showMiddlename) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'middlename'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'lastname'), - 'sort_order' => $elementSort++ - ] -); -if ($showSuffix) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'suffix'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'company'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'street'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'city'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'region'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'postcode'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'country_id'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'telephone'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'fax'), - 'sort_order' => $elementSort++ - ] -); - -/** - ***************************************************************************** - * checkout/onepage/shipping_address - ***************************************************************************** - */ - -$setup->insert( - $installer->getTable('eav_form_type'), - [ - 'code' => 'checkout_onepage_shipping_address', - 'label' => 'checkout_onepage_shipping_address', - 'is_system' => 1, - 'theme' => '', - 'store_id' => 0 - ] -); -$formTypeId = $setup->lastInsertId($installer->getTable('eav_form_type')); - -$setup->insert( - $installer->getTable('eav_form_type_entity'), - ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId] -); - -$elementSort = 0; -if ($showPrefix) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'prefix'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'firstname'), - 'sort_order' => $elementSort++ - ] -); -if ($showMiddlename) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'middlename'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'lastname'), - 'sort_order' => $elementSort++ - ] -); -if ($showSuffix) { - $setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'suffix'), - 'sort_order' => $elementSort++ - ] - ); -} -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'company'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'street'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'city'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'region'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'postcode'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'country_id'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'telephone'), - 'sort_order' => $elementSort++ - ] -); -$setup->insert( - $installer->getTable('eav_form_element'), - [ - 'type_id' => $formTypeId, - 'fieldset_id' => null, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'fax'), - 'sort_order' => $elementSort++ - ] -); - -$table = $installer->getTable('core_config_data'); - -$select = $setup->select()->from( - $table, - ['config_id', 'value'] -)->where( - 'path = ?', - 'checkout/options/onepage_checkout_disabled' -); - -$data = $setup->fetchAll($select); - -if ($data) { - try { - $setup->beginTransaction(); - - foreach ($data as $value) { - $bind = ['path' => 'checkout/options/onepage_checkout_enabled', 'value' => !(bool)$value['value']]; - $where = 'config_id = ' . $value['config_id']; - $setup->update($table, $bind, $where); - } - - $setup->commit(); - } catch (\Exception $e) { - $setup->rollback(); - throw $e; - } -} - -$installer->endSetup(); diff --git a/app/code/Magento/Checkout/etc/di.xml b/app/code/Magento/Checkout/etc/di.xml index f7d28cc7c961c..42d589f77e2dc 100644 --- a/app/code/Magento/Checkout/etc/di.xml +++ b/app/code/Magento/Checkout/etc/di.xml @@ -6,13 +6,6 @@ */ --> - - - - Magento\Checkout\Model\Resource\Setup - - - checkout diff --git a/app/code/Magento/Cms/Model/Resource/Setup.php b/app/code/Magento/Cms/Model/Resource/Setup.php deleted file mode 100644 index fba133558ce22..0000000000000 --- a/app/code/Magento/Cms/Model/Resource/Setup.php +++ /dev/null @@ -1,68 +0,0 @@ -_blockFactory = $blockFactory; - $this->_pageFactory = $pageFactory; - parent::__construct($context, $resourceName, $moduleName, $connectionName); - } - - /** - * Create block - * - * @return \Magento\Cms\Model\Block - */ - public function createBlock() - { - return $this->_blockFactory->create(); - } - - /** - * Create page - * - * @return \Magento\Cms\Model\Page - */ - public function createPage() - { - return $this->_pageFactory->create(); - } -} diff --git a/app/code/Magento/Cms/data/cms_setup/data-install-2.0.0.php b/app/code/Magento/Cms/Setup/InstallData.php similarity index 58% rename from app/code/Magento/Cms/data/cms_setup/data-install-2.0.0.php rename to app/code/Magento/Cms/Setup/InstallData.php index 54d3289b97e39..a85d2b4071ca0 100644 --- a/app/code/Magento/Cms/data/cms_setup/data-install-2.0.0.php +++ b/app/code/Magento/Cms/Setup/InstallData.php @@ -3,53 +3,77 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ +namespace Magento\Cms\Setup; -// @codingStandardsIgnoreFile +use Magento\Cms\Model\Page; +use Magento\Cms\Model\PageFactory; +use Magento\Framework\Module\Setup\Migration; +use Magento\Framework\Setup\InstallDataInterface; +use Magento\Framework\Setup\ModuleContextInterface; +use Magento\Framework\Setup\ModuleDataResourceInterface; -/** @var $this \Magento\Cms\Model\Resource\Setup */ +class InstallData implements InstallDataInterface +{ + /** + * @var PageFactory + */ + private $pageFactory; -$cmsPages = [ - [ - 'title' => '404 Not Found', - 'page_layout' => '2columns-right', - 'meta_keywords' => 'Page keywords', - 'meta_description' => 'Page description', - 'identifier' => 'no-route', - 'content_heading' => 'Whoops, our bad...', - 'content' => "
\r\n
The page you requested was not found, and we have a fine guess why.
\r\n
\r\n
    \r\n
  • If you typed the URL directly, please make sure the spelling is correct.
  • \r\n
  • If you clicked on a link to get here, the link is outdated.
  • \r\n
\r\n
\r\n
\r\n
What can you do?
\r\n
Have no fear, help is near! There are many ways you can get back on track with Magento Store.
\r\n
\r\n
    \r\n
  • Go back to the previous page.
  • \r\n
  • Use the search bar at the top of the page to search for your products.
  • \r\n
  • Follow these links to get you back on track!
    Store Home | My Account
\r\n", - 'is_active' => 1, - 'stores' => [0], - 'sort_order' => 0 - ], - [ - 'title' => 'Home page', - 'page_layout' => '1column', - 'identifier' => 'home', - 'content_heading' => 'Home Page', - 'content' => "

CMS homepage content goes here.

\r\n", - 'is_active' => 1, - 'stores' => [0], - 'sort_order' => 0 - ], - [ - 'title' => 'Enable Cookies', - 'page_layout' => '1column', - 'identifier' => 'enable-cookies', - 'content_heading' => 'What are Cookies?', - 'content' => "
\r\n

\"Cookies\" are little pieces of data we send when you visit our store. Cookies help us get to know you better and personalize your experience. Plus they help protect you and other shoppers from fraud.

\r\n

Set your browser to accept cookies so you can buy items, save items, and receive customized recommendations. Here’s how:

\r\n\r\n
", - 'is_active' => 1, - 'stores' => [0] - ] -]; + /** + * @param PageFactory $pageFactory + */ + public function __construct(PageFactory $pageFactory) + { + $this->pageFactory = $pageFactory; + } -/** - * Insert default and system pages - */ -foreach ($cmsPages as $data) { - $this->createPage()->setData($data)->save(); -} + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + $cmsPages = [ + [ + 'title' => '404 Not Found', + 'page_layout' => '2columns-right', + 'meta_keywords' => 'Page keywords', + 'meta_description' => 'Page description', + 'identifier' => 'no-route', + 'content_heading' => 'Whoops, our bad...', + 'content' => "
\r\n
The page you requested was not found, and we have a fine guess why.
\r\n
\r\n
    \r\n
  • If you typed the URL directly, please make sure the spelling is correct.
  • \r\n
  • If you clicked on a link to get here, the link is outdated.
  • \r\n
\r\n
\r\n
\r\n
What can you do?
\r\n
Have no fear, help is near! There are many ways you can get back on track with Magento Store.
\r\n
\r\n
    \r\n
  • Go back to the previous page.
  • \r\n
  • Use the search bar at the top of the page to search for your products.
  • \r\n
  • Follow these links to get you back on track!
    Store Home | My Account
\r\n", + 'is_active' => 1, + 'stores' => [0], + 'sort_order' => 0 + ], + [ + 'title' => 'Home page', + 'page_layout' => '1column', + 'identifier' => 'home', + 'content_heading' => 'Home Page', + 'content' => "

CMS homepage content goes here.

\r\n", + 'is_active' => 1, + 'stores' => [0], + 'sort_order' => 0 + ], + [ + 'title' => 'Enable Cookies', + 'page_layout' => '1column', + 'identifier' => 'enable-cookies', + 'content_heading' => 'What are Cookies?', + 'content' => "
\r\n

\"Cookies\" are little pieces of data we send when you visit our store. Cookies help us get to know you better and personalize your experience. Plus they help protect you and other shoppers from fraud.

\r\n

Set your browser to accept cookies so you can buy items, save items, and receive customized recommendations. Here’s how:

\r\n\r\n
", + 'is_active' => 1, + 'stores' => [0] + ] + ]; + + /** + * Insert default and system pages + */ + foreach ($cmsPages as $data) { + $this->createPage()->setData($data)->save(); + } -$pageContent = <<
@@ -260,79 +284,95 @@
EOD; -$privacyPageData = [ - 'title' => 'Privacy and Cookie Policy', - 'content_heading' => 'Privacy and Cookie Policy', - 'page_layout' => '1column', - 'identifier' => 'privacy-policy-cookie-restriction-mode', - 'content' => $pageContent, - 'is_active' => 1, - 'stores' => [0], - 'sort_order' => 0, -]; + $privacyPageData = [ + 'title' => 'Privacy and Cookie Policy', + 'content_heading' => 'Privacy and Cookie Policy', + 'page_layout' => '1column', + 'identifier' => 'privacy-policy-cookie-restriction-mode', + 'content' => $pageContent, + 'is_active' => 1, + 'stores' => [0], + 'sort_order' => 0, + ]; -$this->createPage()->setData($privacyPageData)->save(); + $this->createPage()->setData($privacyPageData)->save(); -$footerLinksBlock = $this->createPage()->load('footer_links', 'identifier'); + $footerLinksBlock = $this->createPage()->load('footer_links', 'identifier'); -if ($footerLinksBlock->getId()) { - $content = $footerLinksBlock->getContent(); - if (preg_match('/"; - $content = preg_replace('/<\\/ul>/ims', $replacment, $content); - $footerLinksBlock->setContent($content)->save(); - } -} + if ($footerLinksBlock->getId()) { + $content = $footerLinksBlock->getContent(); + if (preg_match('/"; + $content = preg_replace('/<\\/ul>/ims', $replacment, $content); + $footerLinksBlock->setContent($content)->save(); + } + } -$installer = $this->createMigrationSetup(); -$installer->startSetup(); + $installer = $setup->createMigrationSetup(); + $installer->startSetup(); -$installer->appendClassAliasReplace( - 'cms_block', - 'content', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, - ['block_id'] -); -$installer->appendClassAliasReplace( - 'cms_page', - 'content', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, - ['page_id'] -); -$installer->appendClassAliasReplace( - 'cms_page', - 'layout_update_xml', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, - ['page_id'] -); -$installer->appendClassAliasReplace( - 'cms_page', - 'custom_layout_update_xml', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, - ['page_id'] -); + $installer->appendClassAliasReplace( + 'cms_block', + 'content', + Migration::ENTITY_TYPE_BLOCK, + Migration::FIELD_CONTENT_TYPE_WIKI, + ['block_id'] + ); + $installer->appendClassAliasReplace( + 'cms_page', + 'content', + Migration::ENTITY_TYPE_BLOCK, + Migration::FIELD_CONTENT_TYPE_WIKI, + ['page_id'] + ); + $installer->appendClassAliasReplace( + 'cms_page', + 'layout_update_xml', + Migration::ENTITY_TYPE_BLOCK, + Migration::FIELD_CONTENT_TYPE_XML, + ['page_id'] + ); + $installer->appendClassAliasReplace( + 'cms_page', + 'custom_layout_update_xml', + Migration::ENTITY_TYPE_BLOCK, + Migration::FIELD_CONTENT_TYPE_XML, + ['page_id'] + ); -$installer->doUpdateClassAliases(); + $installer->doUpdateClassAliases(); -$installer->endSetup(); + $installer->endSetup(); -$cookieRestriction = $this->createPage()->load('privacy-policy-cookie-restriction-mode', 'identifier'); + $cookieRestriction = $this->createPage()->load('privacy-policy-cookie-restriction-mode', 'identifier'); -if ($cookieRestriction->getId()) { - $content = $cookieRestriction->getContent(); - $replacment = '{{config path="general/store_information/street_line1"}} ' . - '{{config path="general/store_information/street_line2"}} ' . - '{{config path="general/store_information/city"}} ' . - '{{config path="general/store_information/postcode"}} ' . - '{{config path="general/store_information/region_id"}} ' . - '{{config path="general/store_information/country_id"}}'; - $content = preg_replace('/{{config path="general\\/store_information\\/address"}}/ims', $replacment, $content); - $cookieRestriction->setContent($content)->save(); + if ($cookieRestriction->getId()) { + $content = $cookieRestriction->getContent(); + $replacment = '{{config path="general/store_information/street_line1"}} ' . + '{{config path="general/store_information/street_line2"}} ' . + '{{config path="general/store_information/city"}} ' . + '{{config path="general/store_information/postcode"}} ' . + '{{config path="general/store_information/region_id"}} ' . + '{{config path="general/store_information/country_id"}}'; + $content = preg_replace( + '/{{config path="general\\/store_information\\/address"}}/ims', + $replacment, + $content + ); + $cookieRestriction->setContent($content)->save(); + } + } + + /** + * Create page + * + * @return Page + */ + public function createPage() + { + return $this->pageFactory->create(); + } } diff --git a/app/code/Magento/Cms/etc/di.xml b/app/code/Magento/Cms/etc/di.xml index 2bcb49ffdb456..5180d2671ad2e 100644 --- a/app/code/Magento/Cms/etc/di.xml +++ b/app/code/Magento/Cms/etc/di.xml @@ -45,15 +45,8 @@ - - - -
- - - - - Magento\Cms\Model\Resource\Setup + + diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php new file mode 100644 index 0000000000000..8c2b4132d56fd --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php @@ -0,0 +1,65 @@ +eavSetupFactory = $eavSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var EavSetup $eavSetup */ + $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); + $attributes = [ + 'country_of_manufacture', + 'group_price', + 'minimal_price', + 'msrp', + 'msrp_display_actual_price_type', + 'price', + 'special_price', + 'special_from_date', + 'special_to_date', + 'tier_price', + 'weight', + ]; + foreach ($attributes as $attributeCode) { + $relatedProductTypes = explode( + ',', + $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to') + ); + if (!in_array(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE, $relatedProductTypes)) { + $relatedProductTypes[] = \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE; + $eavSetup->updateAttribute( + \Magento\Catalog\Model\Product::ENTITY, + $attributeCode, + 'apply_to', + implode(',', $relatedProductTypes) + ); + } + } + } +} diff --git a/app/code/Magento/ConfigurableProduct/data/configurableproduct_setup/data-install-2.0.0.php b/app/code/Magento/ConfigurableProduct/data/configurableproduct_setup/data-install-2.0.0.php deleted file mode 100644 index 04afae8316627..0000000000000 --- a/app/code/Magento/ConfigurableProduct/data/configurableproduct_setup/data-install-2.0.0.php +++ /dev/null @@ -1,37 +0,0 @@ -getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to') - ); - if (!in_array(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE, $relatedProductTypes)) { - $relatedProductTypes[] = \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE; - $installer->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - $attributeCode, - 'apply_to', - implode(',', $relatedProductTypes) - ); - } -} diff --git a/app/code/Magento/ConfigurableProduct/etc/di.xml b/app/code/Magento/ConfigurableProduct/etc/di.xml index cbfc757e42a7d..fcd5d77b81e4d 100644 --- a/app/code/Magento/ConfigurableProduct/etc/di.xml +++ b/app/code/Magento/ConfigurableProduct/etc/di.xml @@ -42,13 +42,6 @@ - - - - Magento\Catalog\Model\Resource\Setup - - - diff --git a/app/code/Magento/Customer/Model/Resource/Setup.php b/app/code/Magento/Customer/Model/Resource/Setup.php deleted file mode 100644 index 1349edde16291..0000000000000 --- a/app/code/Magento/Customer/Model/Resource/Setup.php +++ /dev/null @@ -1,460 +0,0 @@ -_eavConfig = $eavConfig; - parent::__construct( - $context, - $resourceName, - $cache, - $attrGroupCollectionFactory, - $moduleName, - $connectionName - ); - } - - /** - * Add customer attributes to customer forms - * - * @return void - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function installCustomerForms() - { - $customer = (int)$this->getEntityTypeId('customer'); - $customerAddress = (int)$this->getEntityTypeId('customer_address'); - - $attributeIds = []; - $select = $this->getConnection()->select()->from( - ['ea' => $this->getTable('eav_attribute')], - ['entity_type_id', 'attribute_code', 'attribute_id'] - )->where( - 'ea.entity_type_id IN(?)', - [$customer, $customerAddress] - ); - foreach ($this->getConnection()->fetchAll($select) as $row) { - $attributeIds[$row['entity_type_id']][$row['attribute_code']] = $row['attribute_id']; - } - - $data = []; - $entities = $this->getDefaultEntities(); - $attributes = $entities['customer']['attributes']; - foreach ($attributes as $attributeCode => $attribute) { - $attributeId = $attributeIds[$customer][$attributeCode]; - $attribute['system'] = isset($attribute['system']) ? $attribute['system'] : true; - $attribute['visible'] = isset($attribute['visible']) ? $attribute['visible'] : true; - if ($attribute['system'] != true || $attribute['visible'] != false) { - $usedInForms = ['customer_account_create', 'customer_account_edit', 'checkout_register']; - if (!empty($attribute['adminhtml_only'])) { - $usedInForms = ['adminhtml_customer']; - } else { - $usedInForms[] = 'adminhtml_customer'; - } - if (!empty($attribute['admin_checkout'])) { - $usedInForms[] = 'adminhtml_checkout'; - } - foreach ($usedInForms as $formCode) { - $data[] = ['form_code' => $formCode, 'attribute_id' => $attributeId]; - } - } - } - - $attributes = $entities['customer_address']['attributes']; - foreach ($attributes as $attributeCode => $attribute) { - $attributeId = $attributeIds[$customerAddress][$attributeCode]; - $attribute['system'] = isset($attribute['system']) ? $attribute['system'] : true; - $attribute['visible'] = isset($attribute['visible']) ? $attribute['visible'] : true; - if (false === ($attribute['system'] == true && $attribute['visible'] == false)) { - $usedInForms = [ - 'adminhtml_customer_address', - 'customer_address_edit', - 'customer_register_address', - ]; - foreach ($usedInForms as $formCode) { - $data[] = ['form_code' => $formCode, 'attribute_id' => $attributeId]; - } - } - } - - if ($data) { - $this->getConnection()->insertMultiple($this->getTable('customer_form_attribute'), $data); - } - } - - /** - * Retrieve default entities: customer, customer_address - * - * @return array - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function getDefaultEntities() - { - $entities = [ - 'customer' => [ - 'entity_model' => 'Magento\Customer\Model\Resource\Customer', - 'attribute_model' => 'Magento\Customer\Model\Attribute', - 'table' => 'customer_entity', - 'increment_model' => 'Magento\Eav\Model\Entity\Increment\Numeric', - 'additional_attribute_table' => 'customer_eav_attribute', - 'entity_attribute_collection' => 'Magento\Customer\Model\Resource\Attribute\Collection', - 'attributes' => [ - 'website_id' => [ - 'type' => 'static', - 'label' => 'Associate to Website', - 'input' => 'select', - 'source' => 'Magento\Customer\Model\Customer\Attribute\Source\Website', - 'backend' => 'Magento\Customer\Model\Customer\Attribute\Backend\Website', - 'sort_order' => 10, - 'position' => 10, - 'adminhtml_only' => 1, - ], - 'store_id' => [ - 'type' => 'static', - 'label' => 'Create In', - 'input' => 'select', - 'source' => 'Magento\Customer\Model\Customer\Attribute\Source\Store', - 'backend' => 'Magento\Customer\Model\Customer\Attribute\Backend\Store', - 'sort_order' => 20, - 'visible' => false, - 'adminhtml_only' => 1, - ], - 'created_in' => [ - 'type' => 'varchar', - 'label' => 'Created From', - 'input' => 'text', - 'required' => false, - 'sort_order' => 20, - 'position' => 20, - 'adminhtml_only' => 1, - ], - 'prefix' => [ - 'type' => 'varchar', - 'label' => 'Prefix', - 'input' => 'text', - 'required' => false, - 'sort_order' => 30, - 'visible' => false, - 'system' => false, - 'position' => 30, - ], - 'firstname' => [ - 'type' => 'varchar', - 'label' => 'First Name', - 'input' => 'text', - 'sort_order' => 40, - 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', - 'position' => 40, - ], - 'middlename' => [ - 'type' => 'varchar', - 'label' => 'Middle Name/Initial', - 'input' => 'text', - 'required' => false, - 'sort_order' => 50, - 'visible' => false, - 'system' => false, - 'position' => 50, - ], - 'lastname' => [ - 'type' => 'varchar', - 'label' => 'Last Name', - 'input' => 'text', - 'sort_order' => 60, - 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', - 'position' => 60, - ], - 'suffix' => [ - 'type' => 'varchar', - 'label' => 'Suffix', - 'input' => 'text', - 'required' => false, - 'sort_order' => 70, - 'visible' => false, - 'system' => false, - 'position' => 70, - ], - 'email' => [ - 'type' => 'static', - 'label' => 'Email', - 'input' => 'text', - 'sort_order' => 80, - 'validate_rules' => 'a:1:{s:16:"input_validation";s:5:"email";}', - 'position' => 80, - 'admin_checkout' => 1, - ], - 'group_id' => [ - 'type' => 'static', - 'label' => 'Group', - 'input' => 'select', - 'source' => 'Magento\Customer\Model\Customer\Attribute\Source\Group', - 'sort_order' => 25, - 'position' => 25, - 'adminhtml_only' => 1, - 'admin_checkout' => 1, - ], - 'dob' => [ - 'type' => 'datetime', - 'label' => 'Date Of Birth', - 'input' => 'date', - 'frontend' => 'Magento\Eav\Model\Entity\Attribute\Frontend\Datetime', - 'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\Datetime', - 'required' => false, - 'sort_order' => 90, - 'visible' => false, - 'system' => false, - 'input_filter' => 'date', - 'validate_rules' => 'a:1:{s:16:"input_validation";s:4:"date";}', - 'position' => 90, - 'admin_checkout' => 1, - ], - 'password_hash' => [ - 'type' => 'varchar', - 'input' => 'hidden', - 'backend' => 'Magento\Customer\Model\Customer\Attribute\Backend\Password', - 'required' => false, - 'sort_order' => 81, - 'visible' => false, - ], - 'default_billing' => [ - 'type' => 'int', - 'label' => 'Default Billing Address', - 'input' => 'text', - 'backend' => 'Magento\Customer\Model\Customer\Attribute\Backend\Billing', - 'required' => false, - 'sort_order' => 82, - 'visible' => false, - ], - 'default_shipping' => [ - 'type' => 'int', - 'label' => 'Default Shipping Address', - 'input' => 'text', - 'backend' => 'Magento\Customer\Model\Customer\Attribute\Backend\Shipping', - 'required' => false, - 'sort_order' => 83, - 'visible' => false, - ], - 'taxvat' => [ - 'type' => 'varchar', - 'label' => 'Tax/VAT Number', - 'input' => 'text', - 'required' => false, - 'sort_order' => 100, - 'visible' => false, - 'system' => false, - 'validate_rules' => 'a:1:{s:15:"max_text_length";i:255;}', - 'position' => 100, - 'admin_checkout' => 1, - ], - 'confirmation' => [ - 'type' => 'varchar', - 'label' => 'Is Confirmed', - 'input' => 'text', - 'required' => false, - 'sort_order' => 85, - 'visible' => false, - ], - 'created_at' => [ - 'type' => 'static', - 'label' => 'Created At', - 'input' => 'date', - 'required' => false, - 'sort_order' => 86, - 'visible' => false, - 'system' => false, - ], - 'gender' => [ - 'type' => 'int', - 'label' => 'Gender', - 'input' => 'select', - 'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Table', - 'required' => false, - 'sort_order' => 110, - 'visible' => false, - 'system' => false, - 'validate_rules' => 'a:0:{}', - 'position' => 110, - 'admin_checkout' => 1, - 'option' => ['values' => ['Male', 'Female']], - ], - ], - ], - 'customer_address' => [ - 'entity_model' => 'Magento\Customer\Model\Resource\Address', - 'attribute_model' => 'Magento\Customer\Model\Attribute', - 'table' => 'customer_address_entity', - 'additional_attribute_table' => 'customer_eav_attribute', - 'entity_attribute_collection' => 'Magento\Customer\Model\Resource\Address\Attribute\Collection', - 'attributes' => [ - 'prefix' => [ - 'type' => 'varchar', - 'label' => 'Prefix', - 'input' => 'text', - 'required' => false, - 'sort_order' => 10, - 'visible' => false, - 'system' => false, - 'position' => 10, - ], - 'firstname' => [ - 'type' => 'varchar', - 'label' => 'First Name', - 'input' => 'text', - 'sort_order' => 20, - 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', - 'position' => 20, - ], - 'middlename' => [ - 'type' => 'varchar', - 'label' => 'Middle Name/Initial', - 'input' => 'text', - 'required' => false, - 'sort_order' => 30, - 'visible' => false, - 'system' => false, - 'position' => 30, - ], - 'lastname' => [ - 'type' => 'varchar', - 'label' => 'Last Name', - 'input' => 'text', - 'sort_order' => 40, - 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', - 'position' => 40, - ], - 'suffix' => [ - 'type' => 'varchar', - 'label' => 'Suffix', - 'input' => 'text', - 'required' => false, - 'sort_order' => 50, - 'visible' => false, - 'system' => false, - 'position' => 50, - ], - 'company' => [ - 'type' => 'varchar', - 'label' => 'Company', - 'input' => 'text', - 'required' => false, - 'sort_order' => 60, - 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', - 'position' => 60, - ], - 'street' => [ - 'type' => 'text', - 'label' => 'Street Address', - 'input' => 'multiline', - 'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend', - 'sort_order' => 70, - 'multiline_count' => 2, - 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', - 'position' => 70, - ], - 'city' => [ - 'type' => 'varchar', - 'label' => 'City', - 'input' => 'text', - 'sort_order' => 80, - 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', - 'position' => 80, - ], - 'country_id' => [ - 'type' => 'varchar', - 'label' => 'Country', - 'input' => 'select', - 'source' => 'Magento\Customer\Model\Resource\Address\Attribute\Source\Country', - 'sort_order' => 90, - 'position' => 90, - ], - 'region' => [ - 'type' => 'varchar', - 'label' => 'State/Province', - 'input' => 'text', - 'backend' => 'Magento\Customer\Model\Resource\Address\Attribute\Backend\Region', - 'required' => false, - 'sort_order' => 100, - 'position' => 100, - ], - 'region_id' => [ - 'type' => 'int', - 'label' => 'State/Province', - 'input' => 'hidden', - 'source' => 'Magento\Customer\Model\Resource\Address\Attribute\Source\Region', - 'required' => false, - 'sort_order' => 100, - 'position' => 100, - ], - 'postcode' => [ - 'type' => 'varchar', - 'label' => 'Zip/Postal Code', - 'input' => 'text', - 'sort_order' => 110, - 'validate_rules' => 'a:0:{}', - 'data' => 'Magento\Customer\Model\Attribute\Data\Postcode', - 'position' => 110, - 'required' => false, - ], - 'telephone' => [ - 'type' => 'varchar', - 'label' => 'Phone Number', - 'input' => 'text', - 'sort_order' => 120, - 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', - 'position' => 120, - ], - 'fax' => [ - 'type' => 'varchar', - 'label' => 'Fax', - 'input' => 'text', - 'required' => false, - 'sort_order' => 130, - 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', - 'position' => 130, - ], - ], - ], - ]; - return $entities; - } - - /** - * @return \Magento\Eav\Model\Config - */ - public function getEavConfig() - { - return $this->_eavConfig; - } -} diff --git a/app/code/Magento/Customer/Setup/Customer.php b/app/code/Magento/Customer/Setup/CustomerSetup.php similarity index 99% rename from app/code/Magento/Customer/Setup/Customer.php rename to app/code/Magento/Customer/Setup/CustomerSetup.php index ae82441cd5262..b93f5c3968e5d 100644 --- a/app/code/Magento/Customer/Setup/Customer.php +++ b/app/code/Magento/Customer/Setup/CustomerSetup.php @@ -9,12 +9,12 @@ use Magento\Eav\Model\Config; use Magento\Eav\Model\Entity\Setup\Context; -use Magento\Eav\Setup\Eav; +use Magento\Eav\Setup\EavSetup; use Magento\Framework\App\CacheInterface; use Magento\Framework\Setup\ModuleDataResourceInterface; use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; -class Customer extends Eav +class CustomerSetup extends EavSetup { /** * @var Config diff --git a/app/code/Magento/Customer/Setup/InstallData.php b/app/code/Magento/Customer/Setup/InstallData.php index 6d3bd31ce2371..0c908eb609c52 100644 --- a/app/code/Magento/Customer/Setup/InstallData.php +++ b/app/code/Magento/Customer/Setup/InstallData.php @@ -5,6 +5,7 @@ */ namespace Magento\Customer\Setup; +use Magento\Framework\Module\Setup\Migration; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataResourceInterface; @@ -12,14 +13,14 @@ class InstallData implements InstallDataInterface { /** - * @var CustomerFactory + * @var CustomerSetupFactory */ private $customerSetupFactory; /** - * @param CustomerFactory $customerSetupFactory + * @param CustomerSetupFactory $customerSetupFactory */ - public function __construct(CustomerFactory $customerSetupFactory) + public function __construct(CustomerSetupFactory $customerSetupFactory) { $this->customerSetupFactory = $customerSetupFactory; } @@ -29,7 +30,7 @@ public function __construct(CustomerFactory $customerSetupFactory) */ public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) { - /** @var Customer $customerSetup */ + /** @var CustomerSetup $customerSetup */ $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]); $setup->startSetup(); @@ -159,8 +160,8 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa $migrationSetup->appendClassAliasReplace( 'customer_eav_attribute', 'data_model', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + Migration::ENTITY_TYPE_MODEL, + Migration::FIELD_CONTENT_TYPE_PLAIN, ['attribute_id'] ); $migrationSetup->doUpdateClassAliases(); diff --git a/app/code/Magento/Customer/data/customer_setup/data-install-2.0.0.php b/app/code/Magento/Customer/data/customer_setup/data-install-2.0.0.php deleted file mode 100644 index b8328afebe2ae..0000000000000 --- a/app/code/Magento/Customer/data/customer_setup/data-install-2.0.0.php +++ /dev/null @@ -1,143 +0,0 @@ -startSetup(); - -// insert default customer groups -$installer->getConnection()->insertForce( - $installer->getTable('customer_group'), - ['customer_group_id' => 0, 'customer_group_code' => 'NOT LOGGED IN', 'tax_class_id' => 3] -); -$installer->getConnection()->insertForce( - $installer->getTable('customer_group'), - ['customer_group_id' => 1, 'customer_group_code' => 'General', 'tax_class_id' => 3] -); -$installer->getConnection()->insertForce( - $installer->getTable('customer_group'), - ['customer_group_id' => 2, 'customer_group_code' => 'Wholesale', 'tax_class_id' => 3] -); -$installer->getConnection()->insertForce( - $installer->getTable('customer_group'), - ['customer_group_id' => 3, 'customer_group_code' => 'Retailer', 'tax_class_id' => 3] -); - -$installer->installEntities(); - -$installer->installCustomerForms(); - -// Add reset password link token attribute -$installer->addAttribute( - 'customer', - 'rp_token', - ['type' => 'varchar', 'input' => 'hidden', 'visible' => false, 'required' => false] -); - -// Add reset password link token creation date attribute -$installer->addAttribute( - 'customer', - 'rp_token_created_at', - [ - 'type' => 'datetime', - 'input' => 'date', - 'validate_rules' => 'a:1:{s:16:"input_validation";s:4:"date";}', - 'visible' => false, - 'required' => false - ] -); - -// Add VAT attributes to customer address -$disableAGCAttributeCode = 'disable_auto_group_change'; - -$installer->addAttribute( - 'customer', - $disableAGCAttributeCode, - [ - 'type' => 'static', - 'label' => 'Disable Automatic Group Change Based on VAT ID', - 'input' => 'boolean', - 'backend' => 'Magento\Customer\Model\Attribute\Backend\Data\Boolean', - 'position' => 28, - 'required' => false - ] -); - -$disableAGCAttribute = $installer->getEavConfig()->getAttribute('customer', $disableAGCAttributeCode); -$disableAGCAttribute->setData('used_in_forms', ['adminhtml_customer']); -$disableAGCAttribute->save(); - -$attributesInfo = [ - 'vat_id' => [ - 'label' => 'VAT number', - 'type' => 'varchar', - 'input' => 'text', - 'position' => 140, - 'visible' => true, - 'required' => false, - ], - 'vat_is_valid' => [ - 'label' => 'VAT number validity', - 'visible' => false, - 'required' => false, - 'type' => 'int', - ], - 'vat_request_id' => [ - 'label' => 'VAT number validation request ID', - 'type' => 'varchar', - 'visible' => false, - 'required' => false, - ], - 'vat_request_date' => [ - 'label' => 'VAT number validation request date', - 'type' => 'varchar', - 'visible' => false, - 'required' => false, - ], - 'vat_request_success' => [ - 'label' => 'VAT number validation request success', - 'visible' => false, - 'required' => false, - 'type' => 'int', - ], -]; - -foreach ($attributesInfo as $attributeCode => $attributeParams) { - $installer->addAttribute('customer_address', $attributeCode, $attributeParams); -} - -$vatIdAttribute = $installer->getEavConfig()->getAttribute('customer_address', 'vat_id'); -$vatIdAttribute->setData( - 'used_in_forms', - ['adminhtml_customer_address', 'customer_address_edit', 'customer_register_address'] -); -$vatIdAttribute->save(); - -$entities = $installer->getDefaultEntities(); -foreach ($entities as $entityName => $entity) { - $installer->addEntityType($entityName, $entity); -} - -$installer->updateAttribute( - 'customer_address', - 'street', - 'backend_model', - 'Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend' -); - -$installer = $this->createMigrationSetup(); - -$installer->appendClassAliasReplace( - 'customer_eav_attribute', - 'data_model', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['attribute_id'] -); -$installer->doUpdateClassAliases(); - -$installer->endSetup(); diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 58f81a14892b5..5ea705d5687f4 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -48,13 +48,6 @@ Magento\Customer\Api\CustomerRepositoryInterface\Proxy - - - - Magento\Customer\Model\Resource\Setup - - - \Magento\Customer\Api\CustomerMetadataInterface diff --git a/app/code/Magento/Dhl/Model/Resource/Setup.php b/app/code/Magento/Dhl/Model/Resource/Setup.php deleted file mode 100644 index ffc3bd7b84a93..0000000000000 --- a/app/code/Magento/Dhl/Model/Resource/Setup.php +++ /dev/null @@ -1,42 +0,0 @@ -_localeLists = $localeLists; - parent::__construct($context, $resourceName, $moduleName, $connectionName); - } - - /** - * @return \Magento\Framework\Locale\ListsInterface - */ - public function getLocaleLists() - { - return $this->_localeLists; - } -} diff --git a/app/code/Magento/Dhl/Setup/InstallData.php b/app/code/Magento/Dhl/Setup/InstallData.php new file mode 100644 index 0000000000000..658b35975bf52 --- /dev/null +++ b/app/code/Magento/Dhl/Setup/InstallData.php @@ -0,0 +1,57 @@ +localeLists = $localeLists; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + $days = $this->localeLists->getTranslationList('days'); + + $days = array_keys($days['format']['wide']); + foreach ($days as $key => $value) { + $days[$key] = ucfirst($value); + } + + $select = $setup->getConnection()->select()->from( + $setup->getTable('core_config_data'), + ['config_id', 'value'] + )->where( + 'path = ?', + 'carriers/dhl/shipment_days' + ); + + foreach ($setup->getConnection()->fetchAll($select) as $configRow) { + $row = ['value' => implode(',', array_intersect_key($days, array_flip(explode(',', $configRow['value']))))]; + $setup->getConnection()->update( + $setup->getTable('core_config_data'), + $row, + ['config_id = ?' => $configRow['config_id']] + ); + } + } +} diff --git a/app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.php b/app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.php deleted file mode 100644 index 66f2173b5dcd9..0000000000000 --- a/app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.php +++ /dev/null @@ -1,30 +0,0 @@ -getLocaleLists()->getTranslationList('days'); - -$days = array_keys($days['format']['wide']); -foreach ($days as $key => $value) { - $days[$key] = ucfirst($value); -} - -$select = $this->getConnection()->select()->from( - $this->getTable('core_config_data'), - ['config_id', 'value'] -)->where( - 'path = ?', - 'carriers/dhl/shipment_days' -); - -foreach ($this->getConnection()->fetchAll($select) as $configRow) { - $row = ['value' => implode(',', array_intersect_key($days, array_flip(explode(',', $configRow['value']))))]; - $this->getConnection()->update( - $this->getTable('core_config_data'), - $row, - ['config_id = ?' => $configRow['config_id']] - ); -} diff --git a/app/code/Magento/Dhl/etc/di.xml b/app/code/Magento/Dhl/etc/di.xml index 89b4e652cdc73..6a88ceeb85017 100644 --- a/app/code/Magento/Dhl/etc/di.xml +++ b/app/code/Magento/Dhl/etc/di.xml @@ -6,13 +6,6 @@ */ --> - - - - Magento\Dhl\Model\Resource\Setup - - - diff --git a/app/code/Magento/Directory/Model/Resource/Setup.php b/app/code/Magento/Directory/Model/Resource/Setup.php deleted file mode 100644 index 66d453b8dc237..0000000000000 --- a/app/code/Magento/Directory/Model/Resource/Setup.php +++ /dev/null @@ -1,48 +0,0 @@ - - */ -namespace Magento\Directory\Model\Resource; - -use Magento\Framework\Setup\ModuleDataResourceInterface; - -class Setup extends \Magento\Setup\Module\DataSetup -{ - /** - * @var \Magento\Directory\Helper\Data - */ - protected $_directoryData; - - /** - * @param \Magento\Framework\Module\Setup\Context $context - * @param string $resourceName - * @param \Magento\Directory\Helper\Data $directoryData - * @param string $moduleName - * @param string $connectionName - */ - public function __construct( - \Magento\Framework\Module\Setup\Context $context, - $resourceName, - \Magento\Directory\Helper\Data $directoryData, - $moduleName = 'Magento_Directory', - $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION - ) { - $this->_directoryData = $directoryData; - parent::__construct($context, $resourceName, $moduleName, $connectionName); - } - - /** - * @return \Magento\Directory\Helper\Data - */ - public function getDirectoryData() - { - return $this->_directoryData; - } -} diff --git a/app/code/Magento/Directory/Setup/InstallData.php b/app/code/Magento/Directory/Setup/InstallData.php new file mode 100644 index 0000000000000..a21635c7ee517 --- /dev/null +++ b/app/code/Magento/Directory/Setup/InstallData.php @@ -0,0 +1,855 @@ +directoryData = $directoryData; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** + * Fill table directory/country + */ + $data = [ + ['AD', 'AD', 'AND'], + ['AE', 'AE', 'ARE'], + ['AF', 'AF', 'AFG'], + ['AG', 'AG', 'ATG'], + ['AI', 'AI', 'AIA'], + ['AL', 'AL', 'ALB'], + ['AM', 'AM', 'ARM'], + ['AN', 'AN', 'ANT'], + ['AO', 'AO', 'AGO'], + ['AQ', 'AQ', 'ATA'], + ['AR', 'AR', 'ARG'], + ['AS', 'AS', 'ASM'], + ['AT', 'AT', 'AUT'], + ['AU', 'AU', 'AUS'], + ['AW', 'AW', 'ABW'], + ['AX', 'AX', 'ALA'], + ['AZ', 'AZ', 'AZE'], + ['BA', 'BA', 'BIH'], + ['BB', 'BB', 'BRB'], + ['BD', 'BD', 'BGD'], + ['BE', 'BE', 'BEL'], + ['BF', 'BF', 'BFA'], + ['BG', 'BG', 'BGR'], + ['BH', 'BH', 'BHR'], + ['BI', 'BI', 'BDI'], + ['BJ', 'BJ', 'BEN'], + ['BL', 'BL', 'BLM'], + ['BM', 'BM', 'BMU'], + ['BN', 'BN', 'BRN'], + ['BO', 'BO', 'BOL'], + ['BR', 'BR', 'BRA'], + ['BS', 'BS', 'BHS'], + ['BT', 'BT', 'BTN'], + ['BV', 'BV', 'BVT'], + ['BW', 'BW', 'BWA'], + ['BY', 'BY', 'BLR'], + ['BZ', 'BZ', 'BLZ'], + ['CA', 'CA', 'CAN'], + ['CC', 'CC', 'CCK'], + ['CD', 'CD', 'COD'], + ['CF', 'CF', 'CAF'], + ['CG', 'CG', 'COG'], + ['CH', 'CH', 'CHE'], + ['CI', 'CI', 'CIV'], + ['CK', 'CK', 'COK'], + ['CL', 'CL', 'CHL'], + ['CM', 'CM', 'CMR'], + ['CN', 'CN', 'CHN'], + ['CO', 'CO', 'COL'], + ['CR', 'CR', 'CRI'], + ['CU', 'CU', 'CUB'], + ['CV', 'CV', 'CPV'], + ['CX', 'CX', 'CXR'], + ['CY', 'CY', 'CYP'], + ['CZ', 'CZ', 'CZE'], + ['DE', 'DE', 'DEU'], + ['DJ', 'DJ', 'DJI'], + ['DK', 'DK', 'DNK'], + ['DM', 'DM', 'DMA'], + ['DO', 'DO', 'DOM'], + ['DZ', 'DZ', 'DZA'], + ['EC', 'EC', 'ECU'], + ['EE', 'EE', 'EST'], + ['EG', 'EG', 'EGY'], + ['EH', 'EH', 'ESH'], + ['ER', 'ER', 'ERI'], + ['ES', 'ES', 'ESP'], + ['ET', 'ET', 'ETH'], + ['FI', 'FI', 'FIN'], + ['FJ', 'FJ', 'FJI'], + ['FK', 'FK', 'FLK'], + ['FM', 'FM', 'FSM'], + ['FO', 'FO', 'FRO'], + ['FR', 'FR', 'FRA'], + ['GA', 'GA', 'GAB'], + ['GB', 'GB', 'GBR'], + ['GD', 'GD', 'GRD'], + ['GE', 'GE', 'GEO'], + ['GF', 'GF', 'GUF'], + ['GG', 'GG', 'GGY'], + ['GH', 'GH', 'GHA'], + ['GI', 'GI', 'GIB'], + ['GL', 'GL', 'GRL'], + ['GM', 'GM', 'GMB'], + ['GN', 'GN', 'GIN'], + ['GP', 'GP', 'GLP'], + ['GQ', 'GQ', 'GNQ'], + ['GR', 'GR', 'GRC'], + ['GS', 'GS', 'SGS'], + ['GT', 'GT', 'GTM'], + ['GU', 'GU', 'GUM'], + ['GW', 'GW', 'GNB'], + ['GY', 'GY', 'GUY'], + ['HK', 'HK', 'HKG'], + ['HM', 'HM', 'HMD'], + ['HN', 'HN', 'HND'], + ['HR', 'HR', 'HRV'], + ['HT', 'HT', 'HTI'], + ['HU', 'HU', 'HUN'], + ['ID', 'ID', 'IDN'], + ['IE', 'IE', 'IRL'], + ['IL', 'IL', 'ISR'], + ['IM', 'IM', 'IMN'], + ['IN', 'IN', 'IND'], + ['IO', 'IO', 'IOT'], + ['IQ', 'IQ', 'IRQ'], + ['IR', 'IR', 'IRN'], + ['IS', 'IS', 'ISL'], + ['IT', 'IT', 'ITA'], + ['JE', 'JE', 'JEY'], + ['JM', 'JM', 'JAM'], + ['JO', 'JO', 'JOR'], + ['JP', 'JP', 'JPN'], + ['KE', 'KE', 'KEN'], + ['KG', 'KG', 'KGZ'], + ['KH', 'KH', 'KHM'], + ['KI', 'KI', 'KIR'], + ['KM', 'KM', 'COM'], + ['KN', 'KN', 'KNA'], + ['KP', 'KP', 'PRK'], + ['KR', 'KR', 'KOR'], + ['KW', 'KW', 'KWT'], + ['KY', 'KY', 'CYM'], + ['KZ', 'KZ', 'KAZ'], + ['LA', 'LA', 'LAO'], + ['LB', 'LB', 'LBN'], + ['LC', 'LC', 'LCA'], + ['LI', 'LI', 'LIE'], + ['LK', 'LK', 'LKA'], + ['LR', 'LR', 'LBR'], + ['LS', 'LS', 'LSO'], + ['LT', 'LT', 'LTU'], + ['LU', 'LU', 'LUX'], + ['LV', 'LV', 'LVA'], + ['LY', 'LY', 'LBY'], + ['MA', 'MA', 'MAR'], + ['MC', 'MC', 'MCO'], + ['MD', 'MD', 'MDA'], + ['ME', 'ME', 'MNE'], + ['MF', 'MF', 'MAF'], + ['MG', 'MG', 'MDG'], + ['MH', 'MH', 'MHL'], + ['MK', 'MK', 'MKD'], + ['ML', 'ML', 'MLI'], + ['MM', 'MM', 'MMR'], + ['MN', 'MN', 'MNG'], + ['MO', 'MO', 'MAC'], + ['MP', 'MP', 'MNP'], + ['MQ', 'MQ', 'MTQ'], + ['MR', 'MR', 'MRT'], + ['MS', 'MS', 'MSR'], + ['MT', 'MT', 'MLT'], + ['MU', 'MU', 'MUS'], + ['MV', 'MV', 'MDV'], + ['MW', 'MW', 'MWI'], + ['MX', 'MX', 'MEX'], + ['MY', 'MY', 'MYS'], + ['MZ', 'MZ', 'MOZ'], + ['NA', 'NA', 'NAM'], + ['NC', 'NC', 'NCL'], + ['NE', 'NE', 'NER'], + ['NF', 'NF', 'NFK'], + ['NG', 'NG', 'NGA'], + ['NI', 'NI', 'NIC'], + ['NL', 'NL', 'NLD'], + ['NO', 'NO', 'NOR'], + ['NP', 'NP', 'NPL'], + ['NR', 'NR', 'NRU'], + ['NU', 'NU', 'NIU'], + ['NZ', 'NZ', 'NZL'], + ['OM', 'OM', 'OMN'], + ['PA', 'PA', 'PAN'], + ['PE', 'PE', 'PER'], + ['PF', 'PF', 'PYF'], + ['PG', 'PG', 'PNG'], + ['PH', 'PH', 'PHL'], + ['PK', 'PK', 'PAK'], + ['PL', 'PL', 'POL'], + ['PM', 'PM', 'SPM'], + ['PN', 'PN', 'PCN'], + ['PS', 'PS', 'PSE'], + ['PT', 'PT', 'PRT'], + ['PW', 'PW', 'PLW'], + ['PY', 'PY', 'PRY'], + ['QA', 'QA', 'QAT'], + ['RE', 'RE', 'REU'], + ['RO', 'RO', 'ROU'], + ['RS', 'RS', 'SRB'], + ['RU', 'RU', 'RUS'], + ['RW', 'RW', 'RWA'], + ['SA', 'SA', 'SAU'], + ['SB', 'SB', 'SLB'], + ['SC', 'SC', 'SYC'], + ['SD', 'SD', 'SDN'], + ['SE', 'SE', 'SWE'], + ['SG', 'SG', 'SGP'], + ['SH', 'SH', 'SHN'], + ['SI', 'SI', 'SVN'], + ['SJ', 'SJ', 'SJM'], + ['SK', 'SK', 'SVK'], + ['SL', 'SL', 'SLE'], + ['SM', 'SM', 'SMR'], + ['SN', 'SN', 'SEN'], + ['SO', 'SO', 'SOM'], + ['SR', 'SR', 'SUR'], + ['ST', 'ST', 'STP'], + ['SV', 'SV', 'SLV'], + ['SY', 'SY', 'SYR'], + ['SZ', 'SZ', 'SWZ'], + ['TC', 'TC', 'TCA'], + ['TD', 'TD', 'TCD'], + ['TF', 'TF', 'ATF'], + ['TG', 'TG', 'TGO'], + ['TH', 'TH', 'THA'], + ['TJ', 'TJ', 'TJK'], + ['TK', 'TK', 'TKL'], + ['TL', 'TL', 'TLS'], + ['TM', 'TM', 'TKM'], + ['TN', 'TN', 'TUN'], + ['TO', 'TO', 'TON'], + ['TR', 'TR', 'TUR'], + ['TT', 'TT', 'TTO'], + ['TV', 'TV', 'TUV'], + ['TW', 'TW', 'TWN'], + ['TZ', 'TZ', 'TZA'], + ['UA', 'UA', 'UKR'], + ['UG', 'UG', 'UGA'], + ['UM', 'UM', 'UMI'], + ['US', 'US', 'USA'], + ['UY', 'UY', 'URY'], + ['UZ', 'UZ', 'UZB'], + ['VA', 'VA', 'VAT'], + ['VC', 'VC', 'VCT'], + ['VE', 'VE', 'VEN'], + ['VG', 'VG', 'VGB'], + ['VI', 'VI', 'VIR'], + ['VN', 'VN', 'VNM'], + ['VU', 'VU', 'VUT'], + ['WF', 'WF', 'WLF'], + ['WS', 'WS', 'WSM'], + ['YE', 'YE', 'YEM'], + ['YT', 'YT', 'MYT'], + ['ZA', 'ZA', 'ZAF'], + ['ZM', 'ZM', 'ZMB'], + ['ZW', 'ZW', 'ZWE'], + ]; + + $columns = ['country_id', 'iso2_code', 'iso3_code']; + $setup->getConnection()->insertArray($setup->getTable('directory_country'), $columns, $data); + + /** + * Fill table directory/country_region + * Fill table directory/country_region_name for en_US locale + */ + $data = [ + ['US', 'AL', 'Alabama'], + ['US', 'AK', 'Alaska'], + ['US', 'AS', 'American Samoa'], + ['US', 'AZ', 'Arizona'], + ['US', 'AR', 'Arkansas'], + ['US', 'AE', 'Armed Forces Africa'], + ['US', 'AA', 'Armed Forces Americas'], + ['US', 'AE', 'Armed Forces Canada'], + ['US', 'AE', 'Armed Forces Europe'], + ['US', 'AE', 'Armed Forces Middle East'], + ['US', 'AP', 'Armed Forces Pacific'], + ['US', 'CA', 'California'], + ['US', 'CO', 'Colorado'], + ['US', 'CT', 'Connecticut'], + ['US', 'DE', 'Delaware'], + ['US', 'DC', 'District of Columbia'], + ['US', 'FM', 'Federated States Of Micronesia'], + ['US', 'FL', 'Florida'], + ['US', 'GA', 'Georgia'], + ['US', 'GU', 'Guam'], + ['US', 'HI', 'Hawaii'], + ['US', 'ID', 'Idaho'], + ['US', 'IL', 'Illinois'], + ['US', 'IN', 'Indiana'], + ['US', 'IA', 'Iowa'], + ['US', 'KS', 'Kansas'], + ['US', 'KY', 'Kentucky'], + ['US', 'LA', 'Louisiana'], + ['US', 'ME', 'Maine'], + ['US', 'MH', 'Marshall Islands'], + ['US', 'MD', 'Maryland'], + ['US', 'MA', 'Massachusetts'], + ['US', 'MI', 'Michigan'], + ['US', 'MN', 'Minnesota'], + ['US', 'MS', 'Mississippi'], + ['US', 'MO', 'Missouri'], + ['US', 'MT', 'Montana'], + ['US', 'NE', 'Nebraska'], + ['US', 'NV', 'Nevada'], + ['US', 'NH', 'New Hampshire'], + ['US', 'NJ', 'New Jersey'], + ['US', 'NM', 'New Mexico'], + ['US', 'NY', 'New York'], + ['US', 'NC', 'North Carolina'], + ['US', 'ND', 'North Dakota'], + ['US', 'MP', 'Northern Mariana Islands'], + ['US', 'OH', 'Ohio'], + ['US', 'OK', 'Oklahoma'], + ['US', 'OR', 'Oregon'], + ['US', 'PW', 'Palau'], + ['US', 'PA', 'Pennsylvania'], + ['US', 'PR', 'Puerto Rico'], + ['US', 'RI', 'Rhode Island'], + ['US', 'SC', 'South Carolina'], + ['US', 'SD', 'South Dakota'], + ['US', 'TN', 'Tennessee'], + ['US', 'TX', 'Texas'], + ['US', 'UT', 'Utah'], + ['US', 'VT', 'Vermont'], + ['US', 'VI', 'Virgin Islands'], + ['US', 'VA', 'Virginia'], + ['US', 'WA', 'Washington'], + ['US', 'WV', 'West Virginia'], + ['US', 'WI', 'Wisconsin'], + ['US', 'WY', 'Wyoming'], + ['CA', 'AB', 'Alberta'], + ['CA', 'BC', 'British Columbia'], + ['CA', 'MB', 'Manitoba'], + ['CA', 'NL', 'Newfoundland and Labrador'], + ['CA', 'NB', 'New Brunswick'], + ['CA', 'NS', 'Nova Scotia'], + ['CA', 'NT', 'Northwest Territories'], + ['CA', 'NU', 'Nunavut'], + ['CA', 'ON', 'Ontario'], + ['CA', 'PE', 'Prince Edward Island'], + ['CA', 'QC', 'Quebec'], + ['CA', 'SK', 'Saskatchewan'], + ['CA', 'YT', 'Yukon Territory'], + ['DE', 'NDS', 'Niedersachsen'], + ['DE', 'BAW', 'Baden-Württemberg'], + ['DE', 'BAY', 'Bayern'], + ['DE', 'BER', 'Berlin'], + ['DE', 'BRG', 'Brandenburg'], + ['DE', 'BRE', 'Bremen'], + ['DE', 'HAM', 'Hamburg'], + ['DE', 'HES', 'Hessen'], + ['DE', 'MEC', 'Mecklenburg-Vorpommern'], + ['DE', 'NRW', 'Nordrhein-Westfalen'], + ['DE', 'RHE', 'Rheinland-Pfalz'], + ['DE', 'SAR', 'Saarland'], + ['DE', 'SAS', 'Sachsen'], + ['DE', 'SAC', 'Sachsen-Anhalt'], + ['DE', 'SCN', 'Schleswig-Holstein'], + ['DE', 'THE', 'Thüringen'], + ['AT', 'WI', 'Wien'], + ['AT', 'NO', 'Niederösterreich'], + ['AT', 'OO', 'Oberösterreich'], + ['AT', 'SB', 'Salzburg'], + ['AT', 'KN', 'Kärnten'], + ['AT', 'ST', 'Steiermark'], + ['AT', 'TI', 'Tirol'], + ['AT', 'BL', 'Burgenland'], + ['AT', 'VB', 'Vorarlberg'], + ['CH', 'AG', 'Aargau'], + ['CH', 'AI', 'Appenzell Innerrhoden'], + ['CH', 'AR', 'Appenzell Ausserrhoden'], + ['CH', 'BE', 'Bern'], + ['CH', 'BL', 'Basel-Landschaft'], + ['CH', 'BS', 'Basel-Stadt'], + ['CH', 'FR', 'Freiburg'], + ['CH', 'GE', 'Genf'], + ['CH', 'GL', 'Glarus'], + ['CH', 'GR', 'Graubünden'], + ['CH', 'JU', 'Jura'], + ['CH', 'LU', 'Luzern'], + ['CH', 'NE', 'Neuenburg'], + ['CH', 'NW', 'Nidwalden'], + ['CH', 'OW', 'Obwalden'], + ['CH', 'SG', 'St. Gallen'], + ['CH', 'SH', 'Schaffhausen'], + ['CH', 'SO', 'Solothurn'], + ['CH', 'SZ', 'Schwyz'], + ['CH', 'TG', 'Thurgau'], + ['CH', 'TI', 'Tessin'], + ['CH', 'UR', 'Uri'], + ['CH', 'VD', 'Waadt'], + ['CH', 'VS', 'Wallis'], + ['CH', 'ZG', 'Zug'], + ['CH', 'ZH', 'Zürich'], + ['ES', 'A Coruсa', 'A Coruña'], + ['ES', 'Alava', 'Alava'], + ['ES', 'Albacete', 'Albacete'], + ['ES', 'Alicante', 'Alicante'], + ['ES', 'Almeria', 'Almeria'], + ['ES', 'Asturias', 'Asturias'], + ['ES', 'Avila', 'Avila'], + ['ES', 'Badajoz', 'Badajoz'], + ['ES', 'Baleares', 'Baleares'], + ['ES', 'Barcelona', 'Barcelona'], + ['ES', 'Burgos', 'Burgos'], + ['ES', 'Caceres', 'Caceres'], + ['ES', 'Cadiz', 'Cadiz'], + ['ES', 'Cantabria', 'Cantabria'], + ['ES', 'Castellon', 'Castellon'], + ['ES', 'Ceuta', 'Ceuta'], + ['ES', 'Ciudad Real', 'Ciudad Real'], + ['ES', 'Cordoba', 'Cordoba'], + ['ES', 'Cuenca', 'Cuenca'], + ['ES', 'Girona', 'Girona'], + ['ES', 'Granada', 'Granada'], + ['ES', 'Guadalajara', 'Guadalajara'], + ['ES', 'Guipuzcoa', 'Guipuzcoa'], + ['ES', 'Huelva', 'Huelva'], + ['ES', 'Huesca', 'Huesca'], + ['ES', 'Jaen', 'Jaen'], + ['ES', 'La Rioja', 'La Rioja'], + ['ES', 'Las Palmas', 'Las Palmas'], + ['ES', 'Leon', 'Leon'], + ['ES', 'Lleida', 'Lleida'], + ['ES', 'Lugo', 'Lugo'], + ['ES', 'Madrid', 'Madrid'], + ['ES', 'Malaga', 'Malaga'], + ['ES', 'Melilla', 'Melilla'], + ['ES', 'Murcia', 'Murcia'], + ['ES', 'Navarra', 'Navarra'], + ['ES', 'Ourense', 'Ourense'], + ['ES', 'Palencia', 'Palencia'], + ['ES', 'Pontevedra', 'Pontevedra'], + ['ES', 'Salamanca', 'Salamanca'], + ['ES', 'Santa Cruz de Tenerife', 'Santa Cruz de Tenerife'], + ['ES', 'Segovia', 'Segovia'], + ['ES', 'Sevilla', 'Sevilla'], + ['ES', 'Soria', 'Soria'], + ['ES', 'Tarragona', 'Tarragona'], + ['ES', 'Teruel', 'Teruel'], + ['ES', 'Toledo', 'Toledo'], + ['ES', 'Valencia', 'Valencia'], + ['ES', 'Valladolid', 'Valladolid'], + ['ES', 'Vizcaya', 'Vizcaya'], + ['ES', 'Zamora', 'Zamora'], + ['ES', 'Zaragoza', 'Zaragoza'], + ['FR', 1, 'Ain'], + ['FR', 2, 'Aisne'], + ['FR', 3, 'Allier'], + ['FR', 4, 'Alpes-de-Haute-Provence'], + ['FR', 5, 'Hautes-Alpes'], + ['FR', 6, 'Alpes-Maritimes'], + ['FR', 7, 'Ardèche'], + ['FR', 8, 'Ardennes'], + ['FR', 9, 'Ariège'], + ['FR', 10, 'Aube'], + ['FR', 11, 'Aude'], + ['FR', 12, 'Aveyron'], + ['FR', 13, 'Bouches-du-Rhône'], + ['FR', 14, 'Calvados'], + ['FR', 15, 'Cantal'], + ['FR', 16, 'Charente'], + ['FR', 17, 'Charente-Maritime'], + ['FR', 18, 'Cher'], + ['FR', 19, 'Corrèze'], + ['FR', '2A', 'Corse-du-Sud'], + ['FR', '2B', 'Haute-Corse'], + ['FR', 21, 'Côte-d\'Or'], + ['FR', 22, 'Côtes-d\'Armor'], + ['FR', 23, 'Creuse'], + ['FR', 24, 'Dordogne'], + ['FR', 25, 'Doubs'], + ['FR', 26, 'Drôme'], + ['FR', 27, 'Eure'], + ['FR', 28, 'Eure-et-Loir'], + ['FR', 29, 'Finistère'], + ['FR', 30, 'Gard'], + ['FR', 31, 'Haute-Garonne'], + ['FR', 32, 'Gers'], + ['FR', 33, 'Gironde'], + ['FR', 34, 'Hérault'], + ['FR', 35, 'Ille-et-Vilaine'], + ['FR', 36, 'Indre'], + ['FR', 37, 'Indre-et-Loire'], + ['FR', 38, 'Isère'], + ['FR', 39, 'Jura'], + ['FR', 40, 'Landes'], + ['FR', 41, 'Loir-et-Cher'], + ['FR', 42, 'Loire'], + ['FR', 43, 'Haute-Loire'], + ['FR', 44, 'Loire-Atlantique'], + ['FR', 45, 'Loiret'], + ['FR', 46, 'Lot'], + ['FR', 47, 'Lot-et-Garonne'], + ['FR', 48, 'Lozère'], + ['FR', 49, 'Maine-et-Loire'], + ['FR', 50, 'Manche'], + ['FR', 51, 'Marne'], + ['FR', 52, 'Haute-Marne'], + ['FR', 53, 'Mayenne'], + ['FR', 54, 'Meurthe-et-Moselle'], + ['FR', 55, 'Meuse'], + ['FR', 56, 'Morbihan'], + ['FR', 57, 'Moselle'], + ['FR', 58, 'Nièvre'], + ['FR', 59, 'Nord'], + ['FR', 60, 'Oise'], + ['FR', 61, 'Orne'], + ['FR', 62, 'Pas-de-Calais'], + ['FR', 63, 'Puy-de-Dôme'], + ['FR', 64, 'Pyrénées-Atlantiques'], + ['FR', 65, 'Hautes-Pyrénées'], + ['FR', 66, 'Pyrénées-Orientales'], + ['FR', 67, 'Bas-Rhin'], + ['FR', 68, 'Haut-Rhin'], + ['FR', 69, 'Rhône'], + ['FR', 70, 'Haute-Saône'], + ['FR', 71, 'Saône-et-Loire'], + ['FR', 72, 'Sarthe'], + ['FR', 73, 'Savoie'], + ['FR', 74, 'Haute-Savoie'], + ['FR', 75, 'Paris'], + ['FR', 76, 'Seine-Maritime'], + ['FR', 77, 'Seine-et-Marne'], + ['FR', 78, 'Yvelines'], + ['FR', 79, 'Deux-Sèvres'], + ['FR', 80, 'Somme'], + ['FR', 81, 'Tarn'], + ['FR', 82, 'Tarn-et-Garonne'], + ['FR', 83, 'Var'], + ['FR', 84, 'Vaucluse'], + ['FR', 85, 'Vendée'], + ['FR', 86, 'Vienne'], + ['FR', 87, 'Haute-Vienne'], + ['FR', 88, 'Vosges'], + ['FR', 89, 'Yonne'], + ['FR', 90, 'Territoire-de-Belfort'], + ['FR', 91, 'Essonne'], + ['FR', 92, 'Hauts-de-Seine'], + ['FR', 93, 'Seine-Saint-Denis'], + ['FR', 94, 'Val-de-Marne'], + ['FR', 95, 'Val-d\'Oise'], + ['RO', 'AB', 'Alba'], + ['RO', 'AR', 'Arad'], + ['RO', 'AG', 'Argeş'], + ['RO', 'BC', 'Bacău'], + ['RO', 'BH', 'Bihor'], + ['RO', 'BN', 'Bistriţa-Năsăud'], + ['RO', 'BT', 'Botoşani'], + ['RO', 'BV', 'Braşov'], + ['RO', 'BR', 'Brăila'], + ['RO', 'B', 'Bucureşti'], + ['RO', 'BZ', 'Buzău'], + ['RO', 'CS', 'Caraş-Severin'], + ['RO', 'CL', 'Călăraşi'], + ['RO', 'CJ', 'Cluj'], + ['RO', 'CT', 'Constanţa'], + ['RO', 'CV', 'Covasna'], + ['RO', 'DB', 'Dâmboviţa'], + ['RO', 'DJ', 'Dolj'], + ['RO', 'GL', 'Galaţi'], + ['RO', 'GR', 'Giurgiu'], + ['RO', 'GJ', 'Gorj'], + ['RO', 'HR', 'Harghita'], + ['RO', 'HD', 'Hunedoara'], + ['RO', 'IL', 'Ialomiţa'], + ['RO', 'IS', 'Iaşi'], + ['RO', 'IF', 'Ilfov'], + ['RO', 'MM', 'Maramureş'], + ['RO', 'MH', 'Mehedinţi'], + ['RO', 'MS', 'Mureş'], + ['RO', 'NT', 'Neamţ'], + ['RO', 'OT', 'Olt'], + ['RO', 'PH', 'Prahova'], + ['RO', 'SM', 'Satu-Mare'], + ['RO', 'SJ', 'Sălaj'], + ['RO', 'SB', 'Sibiu'], + ['RO', 'SV', 'Suceava'], + ['RO', 'TR', 'Teleorman'], + ['RO', 'TM', 'Timiş'], + ['RO', 'TL', 'Tulcea'], + ['RO', 'VS', 'Vaslui'], + ['RO', 'VL', 'Vâlcea'], + ['RO', 'VN', 'Vrancea'], + ['FI', 'Lappi', 'Lappi'], + ['FI', 'Pohjois-Pohjanmaa', 'Pohjois-Pohjanmaa'], + ['FI', 'Kainuu', 'Kainuu'], + ['FI', 'Pohjois-Karjala', 'Pohjois-Karjala'], + ['FI', 'Pohjois-Savo', 'Pohjois-Savo'], + ['FI', 'Etelä-Savo', 'Etelä-Savo'], + ['FI', 'Etelä-Pohjanmaa', 'Etelä-Pohjanmaa'], + ['FI', 'Pohjanmaa', 'Pohjanmaa'], + ['FI', 'Pirkanmaa', 'Pirkanmaa'], + ['FI', 'Satakunta', 'Satakunta'], + ['FI', 'Keski-Pohjanmaa', 'Keski-Pohjanmaa'], + ['FI', 'Keski-Suomi', 'Keski-Suomi'], + ['FI', 'Varsinais-Suomi', 'Varsinais-Suomi'], + ['FI', 'Etelä-Karjala', 'Etelä-Karjala'], + ['FI', 'Päijät-Häme', 'Päijät-Häme'], + ['FI', 'Kanta-Häme', 'Kanta-Häme'], + ['FI', 'Uusimaa', 'Uusimaa'], + ['FI', 'Itä-Uusimaa', 'Itä-Uusimaa'], + ['FI', 'Kymenlaakso', 'Kymenlaakso'], + ['FI', 'Ahvenanmaa', 'Ahvenanmaa'], + ['EE', 'EE-37', 'Harjumaa'], + ['EE', 'EE-39', 'Hiiumaa'], + ['EE', 'EE-44', 'Ida-Virumaa'], + ['EE', 'EE-49', 'Jõgevamaa'], + ['EE', 'EE-51', 'Järvamaa'], + ['EE', 'EE-57', 'Läänemaa'], + ['EE', 'EE-59', 'Lääne-Virumaa'], + ['EE', 'EE-65', 'Põlvamaa'], + ['EE', 'EE-67', 'Pärnumaa'], + ['EE', 'EE-70', 'Raplamaa'], + ['EE', 'EE-74', 'Saaremaa'], + ['EE', 'EE-78', 'Tartumaa'], + ['EE', 'EE-82', 'Valgamaa'], + ['EE', 'EE-84', 'Viljandimaa'], + ['EE', 'EE-86', 'Võrumaa'], + ['LV', 'LV-DGV', 'Daugavpils'], + ['LV', 'LV-JEL', 'Jelgava'], + ['LV', 'Jēkabpils', 'Jēkabpils'], + ['LV', 'LV-JUR', 'Jūrmala'], + ['LV', 'LV-LPX', 'Liepāja'], + ['LV', 'LV-LE', 'Liepājas novads'], + ['LV', 'LV-REZ', 'Rēzekne'], + ['LV', 'LV-RIX', 'Rīga'], + ['LV', 'LV-RI', 'Rīgas novads'], + ['LV', 'Valmiera', 'Valmiera'], + ['LV', 'LV-VEN', 'Ventspils'], + ['LV', 'Aglonas novads', 'Aglonas novads'], + ['LV', 'LV-AI', 'Aizkraukles novads'], + ['LV', 'Aizputes novads', 'Aizputes novads'], + ['LV', 'Aknīstes novads', 'Aknīstes novads'], + ['LV', 'Alojas novads', 'Alojas novads'], + ['LV', 'Alsungas novads', 'Alsungas novads'], + ['LV', 'LV-AL', 'Alūksnes novads'], + ['LV', 'Amatas novads', 'Amatas novads'], + ['LV', 'Apes novads', 'Apes novads'], + ['LV', 'Auces novads', 'Auces novads'], + ['LV', 'Babītes novads', 'Babītes novads'], + ['LV', 'Baldones novads', 'Baldones novads'], + ['LV', 'Baltinavas novads', 'Baltinavas novads'], + ['LV', 'LV-BL', 'Balvu novads'], + ['LV', 'LV-BU', 'Bauskas novads'], + ['LV', 'Beverīnas novads', 'Beverīnas novads'], + ['LV', 'Brocēnu novads', 'Brocēnu novads'], + ['LV', 'Burtnieku novads', 'Burtnieku novads'], + ['LV', 'Carnikavas novads', 'Carnikavas novads'], + ['LV', 'Cesvaines novads', 'Cesvaines novads'], + ['LV', 'Ciblas novads', 'Ciblas novads'], + ['LV', 'LV-CE', 'Cēsu novads'], + ['LV', 'Dagdas novads', 'Dagdas novads'], + ['LV', 'LV-DA', 'Daugavpils novads'], + ['LV', 'LV-DO', 'Dobeles novads'], + ['LV', 'Dundagas novads', 'Dundagas novads'], + ['LV', 'Durbes novads', 'Durbes novads'], + ['LV', 'Engures novads', 'Engures novads'], + ['LV', 'Garkalnes novads', 'Garkalnes novads'], + ['LV', 'Grobiņas novads', 'Grobiņas novads'], + ['LV', 'LV-GU', 'Gulbenes novads'], + ['LV', 'Iecavas novads', 'Iecavas novads'], + ['LV', 'Ikšķiles novads', 'Ikšķiles novads'], + ['LV', 'Ilūkstes novads', 'Ilūkstes novads'], + ['LV', 'Inčukalna novads', 'Inčukalna novads'], + ['LV', 'Jaunjelgavas novads', 'Jaunjelgavas novads'], + ['LV', 'Jaunpiebalgas novads', 'Jaunpiebalgas novads'], + ['LV', 'Jaunpils novads', 'Jaunpils novads'], + ['LV', 'LV-JL', 'Jelgavas novads'], + ['LV', 'LV-JK', 'Jēkabpils novads'], + ['LV', 'Kandavas novads', 'Kandavas novads'], + ['LV', 'Kokneses novads', 'Kokneses novads'], + ['LV', 'Krimuldas novads', 'Krimuldas novads'], + ['LV', 'Krustpils novads', 'Krustpils novads'], + ['LV', 'LV-KR', 'Krāslavas novads'], + ['LV', 'LV-KU', 'Kuldīgas novads'], + ['LV', 'Kārsavas novads', 'Kārsavas novads'], + ['LV', 'Lielvārdes novads', 'Lielvārdes novads'], + ['LV', 'LV-LM', 'Limbažu novads'], + ['LV', 'Lubānas novads', 'Lubānas novads'], + ['LV', 'LV-LU', 'Ludzas novads'], + ['LV', 'Līgatnes novads', 'Līgatnes novads'], + ['LV', 'Līvānu novads', 'Līvānu novads'], + ['LV', 'LV-MA', 'Madonas novads'], + ['LV', 'Mazsalacas novads', 'Mazsalacas novads'], + ['LV', 'Mālpils novads', 'Mālpils novads'], + ['LV', 'Mārupes novads', 'Mārupes novads'], + ['LV', 'Naukšēnu novads', 'Naukšēnu novads'], + ['LV', 'Neretas novads', 'Neretas novads'], + ['LV', 'Nīcas novads', 'Nīcas novads'], + ['LV', 'LV-OG', 'Ogres novads'], + ['LV', 'Olaines novads', 'Olaines novads'], + ['LV', 'Ozolnieku novads', 'Ozolnieku novads'], + ['LV', 'LV-PR', 'Preiļu novads'], + ['LV', 'Priekules novads', 'Priekules novads'], + ['LV', 'Priekuļu novads', 'Priekuļu novads'], + ['LV', 'Pārgaujas novads', 'Pārgaujas novads'], + ['LV', 'Pāvilostas novads', 'Pāvilostas novads'], + ['LV', 'Pļaviņu novads', 'Pļaviņu novads'], + ['LV', 'Raunas novads', 'Raunas novads'], + ['LV', 'Riebiņu novads', 'Riebiņu novads'], + ['LV', 'Rojas novads', 'Rojas novads'], + ['LV', 'Ropažu novads', 'Ropažu novads'], + ['LV', 'Rucavas novads', 'Rucavas novads'], + ['LV', 'Rugāju novads', 'Rugāju novads'], + ['LV', 'Rundāles novads', 'Rundāles novads'], + ['LV', 'LV-RE', 'Rēzeknes novads'], + ['LV', 'Rūjienas novads', 'Rūjienas novads'], + ['LV', 'Salacgrīvas novads', 'Salacgrīvas novads'], + ['LV', 'Salas novads', 'Salas novads'], + ['LV', 'Salaspils novads', 'Salaspils novads'], + ['LV', 'LV-SA', 'Saldus novads'], + ['LV', 'Saulkrastu novads', 'Saulkrastu novads'], + ['LV', 'Siguldas novads', 'Siguldas novads'], + ['LV', 'Skrundas novads', 'Skrundas novads'], + ['LV', 'Skrīveru novads', 'Skrīveru novads'], + ['LV', 'Smiltenes novads', 'Smiltenes novads'], + ['LV', 'Stopiņu novads', 'Stopiņu novads'], + ['LV', 'Strenču novads', 'Strenču novads'], + ['LV', 'Sējas novads', 'Sējas novads'], + ['LV', 'LV-TA', 'Talsu novads'], + ['LV', 'LV-TU', 'Tukuma novads'], + ['LV', 'Tērvetes novads', 'Tērvetes novads'], + ['LV', 'Vaiņodes novads', 'Vaiņodes novads'], + ['LV', 'LV-VK', 'Valkas novads'], + ['LV', 'LV-VM', 'Valmieras novads'], + ['LV', 'Varakļānu novads', 'Varakļānu novads'], + ['LV', 'Vecpiebalgas novads', 'Vecpiebalgas novads'], + ['LV', 'Vecumnieku novads', 'Vecumnieku novads'], + ['LV', 'LV-VE', 'Ventspils novads'], + ['LV', 'Viesītes novads', 'Viesītes novads'], + ['LV', 'Viļakas novads', 'Viļakas novads'], + ['LV', 'Viļānu novads', 'Viļānu novads'], + ['LV', 'Vārkavas novads', 'Vārkavas novads'], + ['LV', 'Zilupes novads', 'Zilupes novads'], + ['LV', 'Ādažu novads', 'Ādažu novads'], + ['LV', 'Ērgļu novads', 'Ērgļu novads'], + ['LV', 'Ķeguma novads', 'Ķeguma novads'], + ['LV', 'Ķekavas novads', 'Ķekavas novads'], + ['LT', 'LT-AL', 'Alytaus Apskritis'], + ['LT', 'LT-KU', 'Kauno Apskritis'], + ['LT', 'LT-KL', 'Klaipėdos Apskritis'], + ['LT', 'LT-MR', 'Marijampolės Apskritis'], + ['LT', 'LT-PN', 'Panevėžio Apskritis'], + ['LT', 'LT-SA', 'Šiaulių Apskritis'], + ['LT', 'LT-TA', 'Tauragės Apskritis'], + ['LT', 'LT-TE', 'Telšių Apskritis'], + ['LT', 'LT-UT', 'Utenos Apskritis'], + ['LT', 'LT-VL', 'Vilniaus Apskritis'], + ['BR', 'AC', 'Acre'], + ['BR', 'AL', 'Alagoas'], + ['BR', 'AP', 'Amapá'], + ['BR', 'AM', 'Amazonas'], + ['BR', 'BA', 'Bahia'], + ['BR', 'CE', 'Ceará'], + ['BR', 'ES', 'Espírito Santo'], + ['BR', 'GO', 'Goiás'], + ['BR', 'MA', 'Maranhão'], + ['BR', 'MT', 'Mato Grosso'], + ['BR', 'MS', 'Mato Grosso do Sul'], + ['BR', 'MG', 'Minas Gerais'], + ['BR', 'PA', 'Pará'], + ['BR', 'PB', 'Paraíba'], + ['BR', 'PR', 'Paraná'], + ['BR', 'PE', 'Pernambuco'], + ['BR', 'PI', 'Piauí'], + ['BR', 'RJ', 'Rio de Janeiro'], + ['BR', 'RN', 'Rio Grande do Norte'], + ['BR', 'RS', 'Rio Grande do Sul'], + ['BR', 'RO', 'Rondônia'], + ['BR', 'RR', 'Roraima'], + ['BR', 'SC', 'Santa Catarina'], + ['BR', 'SP', 'São Paulo'], + ['BR', 'SE', 'Sergipe'], + ['BR', 'TO', 'Tocantins'], + ['BR', 'DF', 'Distrito Federal'] + ]; + + foreach ($data as $row) { + $bind = ['country_id' => $row[0], 'code' => $row[1], 'default_name' => $row[2]]; + $setup->getConnection()->insert($setup->getTable('directory_country_region'), $bind); + $regionId = $setup->getConnection()->lastInsertId($setup->getTable('directory_country_region')); + + $bind = ['locale' => 'en_US', 'region_id' => $regionId, 'name' => $row[2]]; + $setup->getConnection()->insert($setup->getTable('directory_country_region_name'), $bind); + } + + /** + * Fill table directory/currency_rate + */ + $data = [ + ['EUR', 'EUR', 1], + ['EUR', 'USD', 1.415000000000], + ['USD', 'EUR', 0.706700000000], + ['USD', 'USD', 1], + ]; + + $columns = ['currency_from', 'currency_to', 'rate']; + $setup->getConnection()->insertArray($setup->getTable('directory_currency_rate'), $columns, $data); + + $setup->getConnection()->insert( + $setup->getTable('core_config_data'), + [ + 'scope' => 'default', + 'scope_id' => 0, + 'path' => Data::XML_PATH_DISPLAY_ALL_STATES, + 'value' => 1 + ] + ); + + /** + * @var $countries array + */ + $countries = []; + foreach ($this->directoryData->getCountryCollection() as $country) { + if ($country->getRegionCollection()->getSize() > 0) { + $countries[] = $country->getId(); + } + } + + $setup->getConnection()->insert( + $setup->getTable('core_config_data'), + [ + 'scope' => 'default', + 'scope_id' => 0, + 'path' => Data::XML_PATH_STATES_REQUIRED, + 'value' => implode(',', $countries) + ] + ); + } +} diff --git a/app/code/Magento/Directory/data/directory_setup/data-install-2.0.0.php b/app/code/Magento/Directory/data/directory_setup/data-install-2.0.0.php deleted file mode 100644 index 404f26f78960e..0000000000000 --- a/app/code/Magento/Directory/data/directory_setup/data-install-2.0.0.php +++ /dev/null @@ -1,832 +0,0 @@ -getConnection()->insertArray($installer->getTable('directory_country'), $columns, $data); - -/** - * Fill table directory/country_region - * Fill table directory/country_region_name for en_US locale - */ -$data = [ - ['US', 'AL', 'Alabama'], - ['US', 'AK', 'Alaska'], - ['US', 'AS', 'American Samoa'], - ['US', 'AZ', 'Arizona'], - ['US', 'AR', 'Arkansas'], - ['US', 'AE', 'Armed Forces Africa'], - ['US', 'AA', 'Armed Forces Americas'], - ['US', 'AE', 'Armed Forces Canada'], - ['US', 'AE', 'Armed Forces Europe'], - ['US', 'AE', 'Armed Forces Middle East'], - ['US', 'AP', 'Armed Forces Pacific'], - ['US', 'CA', 'California'], - ['US', 'CO', 'Colorado'], - ['US', 'CT', 'Connecticut'], - ['US', 'DE', 'Delaware'], - ['US', 'DC', 'District of Columbia'], - ['US', 'FM', 'Federated States Of Micronesia'], - ['US', 'FL', 'Florida'], - ['US', 'GA', 'Georgia'], - ['US', 'GU', 'Guam'], - ['US', 'HI', 'Hawaii'], - ['US', 'ID', 'Idaho'], - ['US', 'IL', 'Illinois'], - ['US', 'IN', 'Indiana'], - ['US', 'IA', 'Iowa'], - ['US', 'KS', 'Kansas'], - ['US', 'KY', 'Kentucky'], - ['US', 'LA', 'Louisiana'], - ['US', 'ME', 'Maine'], - ['US', 'MH', 'Marshall Islands'], - ['US', 'MD', 'Maryland'], - ['US', 'MA', 'Massachusetts'], - ['US', 'MI', 'Michigan'], - ['US', 'MN', 'Minnesota'], - ['US', 'MS', 'Mississippi'], - ['US', 'MO', 'Missouri'], - ['US', 'MT', 'Montana'], - ['US', 'NE', 'Nebraska'], - ['US', 'NV', 'Nevada'], - ['US', 'NH', 'New Hampshire'], - ['US', 'NJ', 'New Jersey'], - ['US', 'NM', 'New Mexico'], - ['US', 'NY', 'New York'], - ['US', 'NC', 'North Carolina'], - ['US', 'ND', 'North Dakota'], - ['US', 'MP', 'Northern Mariana Islands'], - ['US', 'OH', 'Ohio'], - ['US', 'OK', 'Oklahoma'], - ['US', 'OR', 'Oregon'], - ['US', 'PW', 'Palau'], - ['US', 'PA', 'Pennsylvania'], - ['US', 'PR', 'Puerto Rico'], - ['US', 'RI', 'Rhode Island'], - ['US', 'SC', 'South Carolina'], - ['US', 'SD', 'South Dakota'], - ['US', 'TN', 'Tennessee'], - ['US', 'TX', 'Texas'], - ['US', 'UT', 'Utah'], - ['US', 'VT', 'Vermont'], - ['US', 'VI', 'Virgin Islands'], - ['US', 'VA', 'Virginia'], - ['US', 'WA', 'Washington'], - ['US', 'WV', 'West Virginia'], - ['US', 'WI', 'Wisconsin'], - ['US', 'WY', 'Wyoming'], - ['CA', 'AB', 'Alberta'], - ['CA', 'BC', 'British Columbia'], - ['CA', 'MB', 'Manitoba'], - ['CA', 'NL', 'Newfoundland and Labrador'], - ['CA', 'NB', 'New Brunswick'], - ['CA', 'NS', 'Nova Scotia'], - ['CA', 'NT', 'Northwest Territories'], - ['CA', 'NU', 'Nunavut'], - ['CA', 'ON', 'Ontario'], - ['CA', 'PE', 'Prince Edward Island'], - ['CA', 'QC', 'Quebec'], - ['CA', 'SK', 'Saskatchewan'], - ['CA', 'YT', 'Yukon Territory'], - ['DE', 'NDS', 'Niedersachsen'], - ['DE', 'BAW', 'Baden-Württemberg'], - ['DE', 'BAY', 'Bayern'], - ['DE', 'BER', 'Berlin'], - ['DE', 'BRG', 'Brandenburg'], - ['DE', 'BRE', 'Bremen'], - ['DE', 'HAM', 'Hamburg'], - ['DE', 'HES', 'Hessen'], - ['DE', 'MEC', 'Mecklenburg-Vorpommern'], - ['DE', 'NRW', 'Nordrhein-Westfalen'], - ['DE', 'RHE', 'Rheinland-Pfalz'], - ['DE', 'SAR', 'Saarland'], - ['DE', 'SAS', 'Sachsen'], - ['DE', 'SAC', 'Sachsen-Anhalt'], - ['DE', 'SCN', 'Schleswig-Holstein'], - ['DE', 'THE', 'Thüringen'], - ['AT', 'WI', 'Wien'], - ['AT', 'NO', 'Niederösterreich'], - ['AT', 'OO', 'Oberösterreich'], - ['AT', 'SB', 'Salzburg'], - ['AT', 'KN', 'Kärnten'], - ['AT', 'ST', 'Steiermark'], - ['AT', 'TI', 'Tirol'], - ['AT', 'BL', 'Burgenland'], - ['AT', 'VB', 'Vorarlberg'], - ['CH', 'AG', 'Aargau'], - ['CH', 'AI', 'Appenzell Innerrhoden'], - ['CH', 'AR', 'Appenzell Ausserrhoden'], - ['CH', 'BE', 'Bern'], - ['CH', 'BL', 'Basel-Landschaft'], - ['CH', 'BS', 'Basel-Stadt'], - ['CH', 'FR', 'Freiburg'], - ['CH', 'GE', 'Genf'], - ['CH', 'GL', 'Glarus'], - ['CH', 'GR', 'Graubünden'], - ['CH', 'JU', 'Jura'], - ['CH', 'LU', 'Luzern'], - ['CH', 'NE', 'Neuenburg'], - ['CH', 'NW', 'Nidwalden'], - ['CH', 'OW', 'Obwalden'], - ['CH', 'SG', 'St. Gallen'], - ['CH', 'SH', 'Schaffhausen'], - ['CH', 'SO', 'Solothurn'], - ['CH', 'SZ', 'Schwyz'], - ['CH', 'TG', 'Thurgau'], - ['CH', 'TI', 'Tessin'], - ['CH', 'UR', 'Uri'], - ['CH', 'VD', 'Waadt'], - ['CH', 'VS', 'Wallis'], - ['CH', 'ZG', 'Zug'], - ['CH', 'ZH', 'Zürich'], - ['ES', 'A Coruсa', 'A Coruña'], - ['ES', 'Alava', 'Alava'], - ['ES', 'Albacete', 'Albacete'], - ['ES', 'Alicante', 'Alicante'], - ['ES', 'Almeria', 'Almeria'], - ['ES', 'Asturias', 'Asturias'], - ['ES', 'Avila', 'Avila'], - ['ES', 'Badajoz', 'Badajoz'], - ['ES', 'Baleares', 'Baleares'], - ['ES', 'Barcelona', 'Barcelona'], - ['ES', 'Burgos', 'Burgos'], - ['ES', 'Caceres', 'Caceres'], - ['ES', 'Cadiz', 'Cadiz'], - ['ES', 'Cantabria', 'Cantabria'], - ['ES', 'Castellon', 'Castellon'], - ['ES', 'Ceuta', 'Ceuta'], - ['ES', 'Ciudad Real', 'Ciudad Real'], - ['ES', 'Cordoba', 'Cordoba'], - ['ES', 'Cuenca', 'Cuenca'], - ['ES', 'Girona', 'Girona'], - ['ES', 'Granada', 'Granada'], - ['ES', 'Guadalajara', 'Guadalajara'], - ['ES', 'Guipuzcoa', 'Guipuzcoa'], - ['ES', 'Huelva', 'Huelva'], - ['ES', 'Huesca', 'Huesca'], - ['ES', 'Jaen', 'Jaen'], - ['ES', 'La Rioja', 'La Rioja'], - ['ES', 'Las Palmas', 'Las Palmas'], - ['ES', 'Leon', 'Leon'], - ['ES', 'Lleida', 'Lleida'], - ['ES', 'Lugo', 'Lugo'], - ['ES', 'Madrid', 'Madrid'], - ['ES', 'Malaga', 'Malaga'], - ['ES', 'Melilla', 'Melilla'], - ['ES', 'Murcia', 'Murcia'], - ['ES', 'Navarra', 'Navarra'], - ['ES', 'Ourense', 'Ourense'], - ['ES', 'Palencia', 'Palencia'], - ['ES', 'Pontevedra', 'Pontevedra'], - ['ES', 'Salamanca', 'Salamanca'], - ['ES', 'Santa Cruz de Tenerife', 'Santa Cruz de Tenerife'], - ['ES', 'Segovia', 'Segovia'], - ['ES', 'Sevilla', 'Sevilla'], - ['ES', 'Soria', 'Soria'], - ['ES', 'Tarragona', 'Tarragona'], - ['ES', 'Teruel', 'Teruel'], - ['ES', 'Toledo', 'Toledo'], - ['ES', 'Valencia', 'Valencia'], - ['ES', 'Valladolid', 'Valladolid'], - ['ES', 'Vizcaya', 'Vizcaya'], - ['ES', 'Zamora', 'Zamora'], - ['ES', 'Zaragoza', 'Zaragoza'], - ['FR', 1, 'Ain'], - ['FR', 2, 'Aisne'], - ['FR', 3, 'Allier'], - ['FR', 4, 'Alpes-de-Haute-Provence'], - ['FR', 5, 'Hautes-Alpes'], - ['FR', 6, 'Alpes-Maritimes'], - ['FR', 7, 'Ardèche'], - ['FR', 8, 'Ardennes'], - ['FR', 9, 'Ariège'], - ['FR', 10, 'Aube'], - ['FR', 11, 'Aude'], - ['FR', 12, 'Aveyron'], - ['FR', 13, 'Bouches-du-Rhône'], - ['FR', 14, 'Calvados'], - ['FR', 15, 'Cantal'], - ['FR', 16, 'Charente'], - ['FR', 17, 'Charente-Maritime'], - ['FR', 18, 'Cher'], - ['FR', 19, 'Corrèze'], - ['FR', '2A', 'Corse-du-Sud'], - ['FR', '2B', 'Haute-Corse'], - ['FR', 21, 'Côte-d\'Or'], - ['FR', 22, 'Côtes-d\'Armor'], - ['FR', 23, 'Creuse'], - ['FR', 24, 'Dordogne'], - ['FR', 25, 'Doubs'], - ['FR', 26, 'Drôme'], - ['FR', 27, 'Eure'], - ['FR', 28, 'Eure-et-Loir'], - ['FR', 29, 'Finistère'], - ['FR', 30, 'Gard'], - ['FR', 31, 'Haute-Garonne'], - ['FR', 32, 'Gers'], - ['FR', 33, 'Gironde'], - ['FR', 34, 'Hérault'], - ['FR', 35, 'Ille-et-Vilaine'], - ['FR', 36, 'Indre'], - ['FR', 37, 'Indre-et-Loire'], - ['FR', 38, 'Isère'], - ['FR', 39, 'Jura'], - ['FR', 40, 'Landes'], - ['FR', 41, 'Loir-et-Cher'], - ['FR', 42, 'Loire'], - ['FR', 43, 'Haute-Loire'], - ['FR', 44, 'Loire-Atlantique'], - ['FR', 45, 'Loiret'], - ['FR', 46, 'Lot'], - ['FR', 47, 'Lot-et-Garonne'], - ['FR', 48, 'Lozère'], - ['FR', 49, 'Maine-et-Loire'], - ['FR', 50, 'Manche'], - ['FR', 51, 'Marne'], - ['FR', 52, 'Haute-Marne'], - ['FR', 53, 'Mayenne'], - ['FR', 54, 'Meurthe-et-Moselle'], - ['FR', 55, 'Meuse'], - ['FR', 56, 'Morbihan'], - ['FR', 57, 'Moselle'], - ['FR', 58, 'Nièvre'], - ['FR', 59, 'Nord'], - ['FR', 60, 'Oise'], - ['FR', 61, 'Orne'], - ['FR', 62, 'Pas-de-Calais'], - ['FR', 63, 'Puy-de-Dôme'], - ['FR', 64, 'Pyrénées-Atlantiques'], - ['FR', 65, 'Hautes-Pyrénées'], - ['FR', 66, 'Pyrénées-Orientales'], - ['FR', 67, 'Bas-Rhin'], - ['FR', 68, 'Haut-Rhin'], - ['FR', 69, 'Rhône'], - ['FR', 70, 'Haute-Saône'], - ['FR', 71, 'Saône-et-Loire'], - ['FR', 72, 'Sarthe'], - ['FR', 73, 'Savoie'], - ['FR', 74, 'Haute-Savoie'], - ['FR', 75, 'Paris'], - ['FR', 76, 'Seine-Maritime'], - ['FR', 77, 'Seine-et-Marne'], - ['FR', 78, 'Yvelines'], - ['FR', 79, 'Deux-Sèvres'], - ['FR', 80, 'Somme'], - ['FR', 81, 'Tarn'], - ['FR', 82, 'Tarn-et-Garonne'], - ['FR', 83, 'Var'], - ['FR', 84, 'Vaucluse'], - ['FR', 85, 'Vendée'], - ['FR', 86, 'Vienne'], - ['FR', 87, 'Haute-Vienne'], - ['FR', 88, 'Vosges'], - ['FR', 89, 'Yonne'], - ['FR', 90, 'Territoire-de-Belfort'], - ['FR', 91, 'Essonne'], - ['FR', 92, 'Hauts-de-Seine'], - ['FR', 93, 'Seine-Saint-Denis'], - ['FR', 94, 'Val-de-Marne'], - ['FR', 95, 'Val-d\'Oise'], - ['RO', 'AB', 'Alba'], - ['RO', 'AR', 'Arad'], - ['RO', 'AG', 'Argeş'], - ['RO', 'BC', 'Bacău'], - ['RO', 'BH', 'Bihor'], - ['RO', 'BN', 'Bistriţa-Năsăud'], - ['RO', 'BT', 'Botoşani'], - ['RO', 'BV', 'Braşov'], - ['RO', 'BR', 'Brăila'], - ['RO', 'B', 'Bucureşti'], - ['RO', 'BZ', 'Buzău'], - ['RO', 'CS', 'Caraş-Severin'], - ['RO', 'CL', 'Călăraşi'], - ['RO', 'CJ', 'Cluj'], - ['RO', 'CT', 'Constanţa'], - ['RO', 'CV', 'Covasna'], - ['RO', 'DB', 'Dâmboviţa'], - ['RO', 'DJ', 'Dolj'], - ['RO', 'GL', 'Galaţi'], - ['RO', 'GR', 'Giurgiu'], - ['RO', 'GJ', 'Gorj'], - ['RO', 'HR', 'Harghita'], - ['RO', 'HD', 'Hunedoara'], - ['RO', 'IL', 'Ialomiţa'], - ['RO', 'IS', 'Iaşi'], - ['RO', 'IF', 'Ilfov'], - ['RO', 'MM', 'Maramureş'], - ['RO', 'MH', 'Mehedinţi'], - ['RO', 'MS', 'Mureş'], - ['RO', 'NT', 'Neamţ'], - ['RO', 'OT', 'Olt'], - ['RO', 'PH', 'Prahova'], - ['RO', 'SM', 'Satu-Mare'], - ['RO', 'SJ', 'Sălaj'], - ['RO', 'SB', 'Sibiu'], - ['RO', 'SV', 'Suceava'], - ['RO', 'TR', 'Teleorman'], - ['RO', 'TM', 'Timiş'], - ['RO', 'TL', 'Tulcea'], - ['RO', 'VS', 'Vaslui'], - ['RO', 'VL', 'Vâlcea'], - ['RO', 'VN', 'Vrancea'], - ['FI', 'Lappi', 'Lappi'], - ['FI', 'Pohjois-Pohjanmaa', 'Pohjois-Pohjanmaa'], - ['FI', 'Kainuu', 'Kainuu'], - ['FI', 'Pohjois-Karjala', 'Pohjois-Karjala'], - ['FI', 'Pohjois-Savo', 'Pohjois-Savo'], - ['FI', 'Etelä-Savo', 'Etelä-Savo'], - ['FI', 'Etelä-Pohjanmaa', 'Etelä-Pohjanmaa'], - ['FI', 'Pohjanmaa', 'Pohjanmaa'], - ['FI', 'Pirkanmaa', 'Pirkanmaa'], - ['FI', 'Satakunta', 'Satakunta'], - ['FI', 'Keski-Pohjanmaa', 'Keski-Pohjanmaa'], - ['FI', 'Keski-Suomi', 'Keski-Suomi'], - ['FI', 'Varsinais-Suomi', 'Varsinais-Suomi'], - ['FI', 'Etelä-Karjala', 'Etelä-Karjala'], - ['FI', 'Päijät-Häme', 'Päijät-Häme'], - ['FI', 'Kanta-Häme', 'Kanta-Häme'], - ['FI', 'Uusimaa', 'Uusimaa'], - ['FI', 'Itä-Uusimaa', 'Itä-Uusimaa'], - ['FI', 'Kymenlaakso', 'Kymenlaakso'], - ['FI', 'Ahvenanmaa', 'Ahvenanmaa'], - ['EE', 'EE-37', 'Harjumaa'], - ['EE', 'EE-39', 'Hiiumaa'], - ['EE', 'EE-44', 'Ida-Virumaa'], - ['EE', 'EE-49', 'Jõgevamaa'], - ['EE', 'EE-51', 'Järvamaa'], - ['EE', 'EE-57', 'Läänemaa'], - ['EE', 'EE-59', 'Lääne-Virumaa'], - ['EE', 'EE-65', 'Põlvamaa'], - ['EE', 'EE-67', 'Pärnumaa'], - ['EE', 'EE-70', 'Raplamaa'], - ['EE', 'EE-74', 'Saaremaa'], - ['EE', 'EE-78', 'Tartumaa'], - ['EE', 'EE-82', 'Valgamaa'], - ['EE', 'EE-84', 'Viljandimaa'], - ['EE', 'EE-86', 'Võrumaa'], - ['LV', 'LV-DGV', 'Daugavpils'], - ['LV', 'LV-JEL', 'Jelgava'], - ['LV', 'Jēkabpils', 'Jēkabpils'], - ['LV', 'LV-JUR', 'Jūrmala'], - ['LV', 'LV-LPX', 'Liepāja'], - ['LV', 'LV-LE', 'Liepājas novads'], - ['LV', 'LV-REZ', 'Rēzekne'], - ['LV', 'LV-RIX', 'Rīga'], - ['LV', 'LV-RI', 'Rīgas novads'], - ['LV', 'Valmiera', 'Valmiera'], - ['LV', 'LV-VEN', 'Ventspils'], - ['LV', 'Aglonas novads', 'Aglonas novads'], - ['LV', 'LV-AI', 'Aizkraukles novads'], - ['LV', 'Aizputes novads', 'Aizputes novads'], - ['LV', 'Aknīstes novads', 'Aknīstes novads'], - ['LV', 'Alojas novads', 'Alojas novads'], - ['LV', 'Alsungas novads', 'Alsungas novads'], - ['LV', 'LV-AL', 'Alūksnes novads'], - ['LV', 'Amatas novads', 'Amatas novads'], - ['LV', 'Apes novads', 'Apes novads'], - ['LV', 'Auces novads', 'Auces novads'], - ['LV', 'Babītes novads', 'Babītes novads'], - ['LV', 'Baldones novads', 'Baldones novads'], - ['LV', 'Baltinavas novads', 'Baltinavas novads'], - ['LV', 'LV-BL', 'Balvu novads'], - ['LV', 'LV-BU', 'Bauskas novads'], - ['LV', 'Beverīnas novads', 'Beverīnas novads'], - ['LV', 'Brocēnu novads', 'Brocēnu novads'], - ['LV', 'Burtnieku novads', 'Burtnieku novads'], - ['LV', 'Carnikavas novads', 'Carnikavas novads'], - ['LV', 'Cesvaines novads', 'Cesvaines novads'], - ['LV', 'Ciblas novads', 'Ciblas novads'], - ['LV', 'LV-CE', 'Cēsu novads'], - ['LV', 'Dagdas novads', 'Dagdas novads'], - ['LV', 'LV-DA', 'Daugavpils novads'], - ['LV', 'LV-DO', 'Dobeles novads'], - ['LV', 'Dundagas novads', 'Dundagas novads'], - ['LV', 'Durbes novads', 'Durbes novads'], - ['LV', 'Engures novads', 'Engures novads'], - ['LV', 'Garkalnes novads', 'Garkalnes novads'], - ['LV', 'Grobiņas novads', 'Grobiņas novads'], - ['LV', 'LV-GU', 'Gulbenes novads'], - ['LV', 'Iecavas novads', 'Iecavas novads'], - ['LV', 'Ikšķiles novads', 'Ikšķiles novads'], - ['LV', 'Ilūkstes novads', 'Ilūkstes novads'], - ['LV', 'Inčukalna novads', 'Inčukalna novads'], - ['LV', 'Jaunjelgavas novads', 'Jaunjelgavas novads'], - ['LV', 'Jaunpiebalgas novads', 'Jaunpiebalgas novads'], - ['LV', 'Jaunpils novads', 'Jaunpils novads'], - ['LV', 'LV-JL', 'Jelgavas novads'], - ['LV', 'LV-JK', 'Jēkabpils novads'], - ['LV', 'Kandavas novads', 'Kandavas novads'], - ['LV', 'Kokneses novads', 'Kokneses novads'], - ['LV', 'Krimuldas novads', 'Krimuldas novads'], - ['LV', 'Krustpils novads', 'Krustpils novads'], - ['LV', 'LV-KR', 'Krāslavas novads'], - ['LV', 'LV-KU', 'Kuldīgas novads'], - ['LV', 'Kārsavas novads', 'Kārsavas novads'], - ['LV', 'Lielvārdes novads', 'Lielvārdes novads'], - ['LV', 'LV-LM', 'Limbažu novads'], - ['LV', 'Lubānas novads', 'Lubānas novads'], - ['LV', 'LV-LU', 'Ludzas novads'], - ['LV', 'Līgatnes novads', 'Līgatnes novads'], - ['LV', 'Līvānu novads', 'Līvānu novads'], - ['LV', 'LV-MA', 'Madonas novads'], - ['LV', 'Mazsalacas novads', 'Mazsalacas novads'], - ['LV', 'Mālpils novads', 'Mālpils novads'], - ['LV', 'Mārupes novads', 'Mārupes novads'], - ['LV', 'Naukšēnu novads', 'Naukšēnu novads'], - ['LV', 'Neretas novads', 'Neretas novads'], - ['LV', 'Nīcas novads', 'Nīcas novads'], - ['LV', 'LV-OG', 'Ogres novads'], - ['LV', 'Olaines novads', 'Olaines novads'], - ['LV', 'Ozolnieku novads', 'Ozolnieku novads'], - ['LV', 'LV-PR', 'Preiļu novads'], - ['LV', 'Priekules novads', 'Priekules novads'], - ['LV', 'Priekuļu novads', 'Priekuļu novads'], - ['LV', 'Pārgaujas novads', 'Pārgaujas novads'], - ['LV', 'Pāvilostas novads', 'Pāvilostas novads'], - ['LV', 'Pļaviņu novads', 'Pļaviņu novads'], - ['LV', 'Raunas novads', 'Raunas novads'], - ['LV', 'Riebiņu novads', 'Riebiņu novads'], - ['LV', 'Rojas novads', 'Rojas novads'], - ['LV', 'Ropažu novads', 'Ropažu novads'], - ['LV', 'Rucavas novads', 'Rucavas novads'], - ['LV', 'Rugāju novads', 'Rugāju novads'], - ['LV', 'Rundāles novads', 'Rundāles novads'], - ['LV', 'LV-RE', 'Rēzeknes novads'], - ['LV', 'Rūjienas novads', 'Rūjienas novads'], - ['LV', 'Salacgrīvas novads', 'Salacgrīvas novads'], - ['LV', 'Salas novads', 'Salas novads'], - ['LV', 'Salaspils novads', 'Salaspils novads'], - ['LV', 'LV-SA', 'Saldus novads'], - ['LV', 'Saulkrastu novads', 'Saulkrastu novads'], - ['LV', 'Siguldas novads', 'Siguldas novads'], - ['LV', 'Skrundas novads', 'Skrundas novads'], - ['LV', 'Skrīveru novads', 'Skrīveru novads'], - ['LV', 'Smiltenes novads', 'Smiltenes novads'], - ['LV', 'Stopiņu novads', 'Stopiņu novads'], - ['LV', 'Strenču novads', 'Strenču novads'], - ['LV', 'Sējas novads', 'Sējas novads'], - ['LV', 'LV-TA', 'Talsu novads'], - ['LV', 'LV-TU', 'Tukuma novads'], - ['LV', 'Tērvetes novads', 'Tērvetes novads'], - ['LV', 'Vaiņodes novads', 'Vaiņodes novads'], - ['LV', 'LV-VK', 'Valkas novads'], - ['LV', 'LV-VM', 'Valmieras novads'], - ['LV', 'Varakļānu novads', 'Varakļānu novads'], - ['LV', 'Vecpiebalgas novads', 'Vecpiebalgas novads'], - ['LV', 'Vecumnieku novads', 'Vecumnieku novads'], - ['LV', 'LV-VE', 'Ventspils novads'], - ['LV', 'Viesītes novads', 'Viesītes novads'], - ['LV', 'Viļakas novads', 'Viļakas novads'], - ['LV', 'Viļānu novads', 'Viļānu novads'], - ['LV', 'Vārkavas novads', 'Vārkavas novads'], - ['LV', 'Zilupes novads', 'Zilupes novads'], - ['LV', 'Ādažu novads', 'Ādažu novads'], - ['LV', 'Ērgļu novads', 'Ērgļu novads'], - ['LV', 'Ķeguma novads', 'Ķeguma novads'], - ['LV', 'Ķekavas novads', 'Ķekavas novads'], - ['LT', 'LT-AL', 'Alytaus Apskritis'], - ['LT', 'LT-KU', 'Kauno Apskritis'], - ['LT', 'LT-KL', 'Klaipėdos Apskritis'], - ['LT', 'LT-MR', 'Marijampolės Apskritis'], - ['LT', 'LT-PN', 'Panevėžio Apskritis'], - ['LT', 'LT-SA', 'Šiaulių Apskritis'], - ['LT', 'LT-TA', 'Tauragės Apskritis'], - ['LT', 'LT-TE', 'Telšių Apskritis'], - ['LT', 'LT-UT', 'Utenos Apskritis'], - ['LT', 'LT-VL', 'Vilniaus Apskritis'], - ['BR', 'AC', 'Acre'], - ['BR', 'AL', 'Alagoas'], - ['BR', 'AP', 'Amapá'], - ['BR', 'AM', 'Amazonas'], - ['BR', 'BA', 'Bahia'], - ['BR', 'CE', 'Ceará'], - ['BR', 'ES', 'Espírito Santo'], - ['BR', 'GO', 'Goiás'], - ['BR', 'MA', 'Maranhão'], - ['BR', 'MT', 'Mato Grosso'], - ['BR', 'MS', 'Mato Grosso do Sul'], - ['BR', 'MG', 'Minas Gerais'], - ['BR', 'PA', 'Pará'], - ['BR', 'PB', 'Paraíba'], - ['BR', 'PR', 'Paraná'], - ['BR', 'PE', 'Pernambuco'], - ['BR', 'PI', 'Piauí'], - ['BR', 'RJ', 'Rio de Janeiro'], - ['BR', 'RN', 'Rio Grande do Norte'], - ['BR', 'RS', 'Rio Grande do Sul'], - ['BR', 'RO', 'Rondônia'], - ['BR', 'RR', 'Roraima'], - ['BR', 'SC', 'Santa Catarina'], - ['BR', 'SP', 'São Paulo'], - ['BR', 'SE', 'Sergipe'], - ['BR', 'TO', 'Tocantins'], - ['BR', 'DF', 'Distrito Federal'] -]; - -foreach ($data as $row) { - $bind = ['country_id' => $row[0], 'code' => $row[1], 'default_name' => $row[2]]; - $installer->getConnection()->insert($installer->getTable('directory_country_region'), $bind); - $regionId = $installer->getConnection()->lastInsertId($installer->getTable('directory_country_region')); - - $bind = ['locale' => 'en_US', 'region_id' => $regionId, 'name' => $row[2]]; - $installer->getConnection()->insert($installer->getTable('directory_country_region_name'), $bind); -} - -/** - * Fill table directory/currency_rate - */ -$data = [ - ['EUR', 'EUR', 1], - ['EUR', 'USD', 1.415000000000], - ['USD', 'EUR', 0.706700000000], - ['USD', 'USD', 1], -]; - -$columns = ['currency_from', 'currency_to', 'rate']; -$installer->getConnection()->insertArray($installer->getTable('directory_currency_rate'), $columns, $data); - -$installer->getConnection()->insert( - $installer->getTable('core_config_data'), - [ - 'scope' => 'default', - 'scope_id' => 0, - 'path' => \Magento\Directory\Helper\Data::XML_PATH_DISPLAY_ALL_STATES, - 'value' => 1 - ] -); - -/** - * @var $countries array - */ -$countries = []; -foreach ($installer->getDirectoryData()->getCountryCollection() as $country) { - if ($country->getRegionCollection()->getSize() > 0) { - $countries[] = $country->getId(); - } -} - -$installer->getConnection()->insert( - $installer->getTable('core_config_data'), - [ - 'scope' => 'default', - 'scope_id' => 0, - 'path' => \Magento\Directory\Helper\Data::XML_PATH_STATES_REQUIRED, - 'value' => implode(',', $countries) - ] -); diff --git a/app/code/Magento/Directory/etc/di.xml b/app/code/Magento/Directory/etc/di.xml index d4bf4002e32e0..150a7e6c5be22 100644 --- a/app/code/Magento/Directory/etc/di.xml +++ b/app/code/Magento/Directory/etc/di.xml @@ -17,11 +17,4 @@ - - - - Magento\Directory\Model\Resource\Setup - - -
diff --git a/app/code/Magento/Downloadable/Setup/InstallData.php b/app/code/Magento/Downloadable/Setup/InstallData.php new file mode 100644 index 0000000000000..7cf0539a38829 --- /dev/null +++ b/app/code/Magento/Downloadable/Setup/InstallData.php @@ -0,0 +1,167 @@ +eavSetupFactory = $eavSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var EavSetup $eavSetup */ + $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); + /** + * Add attributes to the eav/attribute table + */ + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'links_purchased_separately', + [ + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => 'Links can be purchased separately', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable', + 'used_in_product_listing' => true + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'samples_title', + [ + 'type' => 'varchar', + 'backend' => '', + 'frontend' => '', + 'label' => 'Samples title', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable' + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'links_title', + [ + 'type' => 'varchar', + 'backend' => '', + 'frontend' => '', + 'label' => 'Links title', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable' + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'links_exist', + [ + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => '', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => true, + 'visible' => false, + 'required' => false, + 'user_defined' => false, + 'default' => '0', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable', + 'used_in_product_listing' => 1 + ] + ); + + $fieldList = [ + 'price', + 'special_price', + 'special_from_date', + 'special_to_date', + 'minimal_price', + 'cost', + 'tier_price', + 'group_price', + 'weight', + ]; + + // make these attributes applicable to downloadable products + foreach ($fieldList as $field) { + $applyTo = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')); + if (!in_array('downloadable', $applyTo)) { + $applyTo[] = 'downloadable'; + $eavSetup->updateAttribute( + \Magento\Catalog\Model\Product::ENTITY, + $field, + 'apply_to', + implode(',', $applyTo) + ); + } + } + } +} diff --git a/app/code/Magento/Downloadable/data/downloadable_setup/data-install-2.0.0.php b/app/code/Magento/Downloadable/data/downloadable_setup/data-install-2.0.0.php deleted file mode 100644 index 6e19e8e2e4c45..0000000000000 --- a/app/code/Magento/Downloadable/data/downloadable_setup/data-install-2.0.0.php +++ /dev/null @@ -1,138 +0,0 @@ -addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'links_purchased_separately', - [ - 'type' => 'int', - 'backend' => '', - 'frontend' => '', - 'label' => 'Links can be purchased separately', - 'input' => '', - 'class' => '', - 'source' => '', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, - 'visible' => false, - 'required' => true, - 'user_defined' => false, - 'default' => '', - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'unique' => false, - 'apply_to' => 'downloadable', - 'used_in_product_listing' => true - ] -); - -$installer->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'samples_title', - [ - 'type' => 'varchar', - 'backend' => '', - 'frontend' => '', - 'label' => 'Samples title', - 'input' => '', - 'class' => '', - 'source' => '', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'visible' => false, - 'required' => true, - 'user_defined' => false, - 'default' => '', - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'unique' => false, - 'apply_to' => 'downloadable' - ] -); - -$installer->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'links_title', - [ - 'type' => 'varchar', - 'backend' => '', - 'frontend' => '', - 'label' => 'Links title', - 'input' => '', - 'class' => '', - 'source' => '', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'visible' => false, - 'required' => true, - 'user_defined' => false, - 'default' => '', - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'unique' => false, - 'apply_to' => 'downloadable' - ] -); - -$installer->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'links_exist', - [ - 'type' => 'int', - 'backend' => '', - 'frontend' => '', - 'label' => '', - 'input' => '', - 'class' => '', - 'source' => '', - 'global' => true, - 'visible' => false, - 'required' => false, - 'user_defined' => false, - 'default' => '0', - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'unique' => false, - 'apply_to' => 'downloadable', - 'used_in_product_listing' => 1 - ] -); - -$fieldList = [ - 'price', - 'special_price', - 'special_from_date', - 'special_to_date', - 'minimal_price', - 'cost', - 'tier_price', - 'group_price', - 'weight', -]; - -// make these attributes applicable to downloadable products -foreach ($fieldList as $field) { - $applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')); - if (!in_array('downloadable', $applyTo)) { - $applyTo[] = 'downloadable'; - $installer->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - $field, - 'apply_to', - implode(',', $applyTo) - ); - } -} diff --git a/app/code/Magento/Downloadable/etc/di.xml b/app/code/Magento/Downloadable/etc/di.xml index 8148a87743499..7883e299a74e9 100644 --- a/app/code/Magento/Downloadable/etc/di.xml +++ b/app/code/Magento/Downloadable/etc/di.xml @@ -16,13 +16,6 @@ Virtual / Downloadable - - - - Magento\Catalog\Model\Resource\Setup - - - diff --git a/app/code/Magento/Eav/Model/Entity/Setup.php b/app/code/Magento/Eav/Model/Entity/Setup.php deleted file mode 100644 index 8d8b58d45366b..0000000000000 --- a/app/code/Magento/Eav/Model/Entity/Setup.php +++ /dev/null @@ -1,1353 +0,0 @@ -_cache = $cache; - $this->_attrGroupCollectionFactory = $attrGroupCollectionFactory; - $this->attributeMapper = $context->getAttributeMapper(); - parent::__construct($context, $resourceName, $moduleName, $connectionName); - } - - /** - * General Attribute Group Name - * - * @var string - */ - protected $_generalGroupName = 'General'; - - /** - * Default attribute group name to id pairs - * - * @var array - */ - public $defaultGroupIdAssociations = ['General' => 1]; - - /** - * Default attribute group name - * - * @var string - */ - protected $_defaultGroupName = 'Default'; - - /** - * Default attribute set name - * - * @var string - */ - protected $_defaultAttributeSetName = 'Default'; - - /** - * @return \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection - */ - public function getAttributeGroupCollectionFactory() - { - return $this->_attrGroupCollectionFactory->create(); - } - - /** - * Clean cache - * - * @return $this - */ - public function cleanCache() - { - $this->_cache->clean([\Magento\Eav\Model\Cache\Type::CACHE_TAG]); - return $this; - } - - /** - * Install Default Group Ids - * - * @return $this - */ - public function installDefaultGroupIds() - { - $setIds = $this->getAllAttributeSetIds(); - foreach ($this->defaultGroupIdAssociations as $defaultGroupName => $defaultGroupId) { - foreach ($setIds as $set) { - $groupId = $this->getTableRow( - 'eav_attribute_group', - 'attribute_group_name', - $defaultGroupName, - 'attribute_group_id', - 'attribute_set_id', - $set - ); - if (!$groupId) { - $groupId = $this->getTableRow( - 'eav_attribute_group', - 'attribute_set_id', - $set, - 'attribute_group_id' - ); - } - $this->updateTableRow( - 'eav_attribute_group', - 'attribute_group_id', - $groupId, - 'default_id', - $defaultGroupId - ); - } - } - - return $this; - } - - /******************* ENTITY TYPES *****************/ - - /** - * Add an entity type - * - * If already exists updates the entity type with params data - * - * @param string $code - * @param array $params - * @return $this - */ - public function addEntityType($code, array $params) - { - $data = [ - 'entity_type_code' => $code, - 'entity_model' => $params['entity_model'], - 'attribute_model' => $this->_getValue($params, 'attribute_model'), - 'entity_table' => $this->_getValue($params, 'table', 'eav_entity'), - 'value_table_prefix' => $this->_getValue($params, 'table_prefix'), - 'entity_id_field' => $this->_getValue($params, 'id_field'), - 'increment_model' => $this->_getValue($params, 'increment_model'), - 'increment_per_store' => $this->_getValue($params, 'increment_per_store', 0), - 'increment_pad_length' => $this->_getValue($params, 'increment_pad_length', 8), - 'increment_pad_char' => $this->_getValue($params, 'increment_pad_char', 0), - 'additional_attribute_table' => $this->_getValue($params, 'additional_attribute_table'), - 'entity_attribute_collection' => $this->_getValue($params, 'entity_attribute_collection'), - ]; - - if ($this->getEntityType($code, 'entity_type_id')) { - $this->updateEntityType($code, $data); - } else { - $this->getConnection()->insert($this->getTable('eav_entity_type'), $data); - } - - if (!empty($params['default_group'])) { - $defaultGroup = $params['default_group']; - } else { - $defaultGroup = $this->_defaultGroupName; - } - - $this->addAttributeSet($code, $this->_defaultAttributeSetName); - $this->addAttributeGroup($code, $this->_defaultGroupName, $this->_generalGroupName); - - return $this; - } - - /** - * Update entity row - * - * @param string $code - * @param string $field - * @param string $value - * @return $this - */ - public function updateEntityType($code, $field, $value = null) - { - $this->updateTableRow('eav_entity_type', 'entity_type_id', $this->getEntityTypeId($code), $field, $value); - return $this; - } - - /** - * Retrieve Entity Type Data - * - * @param int|string $id - * @param string $field - * @return mixed - */ - public function getEntityType($id, $field = null) - { - return $this->getTableRow( - 'eav_entity_type', - is_numeric($id) ? 'entity_type_id' : 'entity_type_code', - $id, - $field - ); - } - - /** - * Retrieve Entity Type Id By Id or Code - * - * @param int|string $entityTypeId - * @return int - */ - public function getEntityTypeId($entityTypeId) - { - if (!is_numeric($entityTypeId)) { - $entityTypeId = $this->getEntityType($entityTypeId, 'entity_type_id'); - } - if (!is_numeric($entityTypeId)) { - throw new \Magento\Eav\Exception(__('Wrong entity ID')); - } - - return $entityTypeId; - } - - /** - * Remove entity type by Id or Code - * - * @param int|string $id - * @return $this - */ - public function removeEntityType($id) - { - if (is_numeric($id)) { - $this->deleteTableRow('eav_entity_type', 'entity_type_id', $id); - } else { - $this->deleteTableRow('eav_entity_type', 'entity_type_code', (string)$id); - } - - return $this; - } - - /******************* ATTRIBUTE SETS *****************/ - - /** - * Retrieve Attribute Set Sort order - * - * @param int|string $entityTypeId - * @param int $sortOrder - * @return int - */ - public function getAttributeSetSortOrder($entityTypeId, $sortOrder = null) - { - if (!is_numeric($sortOrder)) { - $bind = ['entity_type_id' => $this->getEntityTypeId($entityTypeId)]; - $select = $this->getConnection()->select()->from( - $this->getTable('eav_attribute_set'), - 'MAX(sort_order)' - )->where( - 'entity_type_id = :entity_type_id' - ); - - $sortOrder = $this->getConnection()->fetchOne($select, $bind) + 1; - } - - return $sortOrder; - } - - /** - * Add Attribute Set - * - * @param int|string $entityTypeId - * @param string $name - * @param int $sortOrder - * @return $this - */ - public function addAttributeSet($entityTypeId, $name, $sortOrder = null) - { - $data = [ - 'entity_type_id' => $this->getEntityTypeId($entityTypeId), - 'attribute_set_name' => $name, - 'sort_order' => $this->getAttributeSetSortOrder($entityTypeId, $sortOrder), - ]; - - $setId = $this->getAttributeSet($entityTypeId, $name, 'attribute_set_id'); - if ($setId) { - $this->updateAttributeSet($entityTypeId, $setId, $data); - } else { - $this->getConnection()->insert($this->getTable('eav_attribute_set'), $data); - - $this->addAttributeGroup($entityTypeId, $name, $this->_generalGroupName); - } - - return $this; - } - - /** - * Update attribute set data - * - * @param int|string $entityTypeId - * @param int $id - * @param string $field - * @param mixed $value - * @return $this - */ - public function updateAttributeSet($entityTypeId, $id, $field, $value = null) - { - $this->updateTableRow( - 'eav_attribute_set', - 'attribute_set_id', - $this->getAttributeSetId($entityTypeId, $id), - $field, - $value, - 'entity_type_id', - $this->getEntityTypeId($entityTypeId) - ); - return $this; - } - - /** - * Retrieve Attribute set data by id or name - * - * @param int|string $entityTypeId - * @param int|string $id - * @param string $field - * @return mixed - */ - public function getAttributeSet($entityTypeId, $id, $field = null) - { - return $this->getTableRow( - 'eav_attribute_set', - is_numeric($id) ? 'attribute_set_id' : 'attribute_set_name', - $id, - $field, - 'entity_type_id', - $this->getEntityTypeId($entityTypeId) - ); - } - - /** - * Retrieve Attribute Set Id By Id or Name - * - * @param int|string $entityTypeId - * @param int|string $setId - * @return int - * @throws \Magento\Eav\Exception - */ - public function getAttributeSetId($entityTypeId, $setId) - { - if (!is_numeric($setId)) { - $setId = $this->getAttributeSet($entityTypeId, $setId, 'attribute_set_id'); - } - if (!is_numeric($setId)) { - throw new \Magento\Eav\Exception(__('Wrong attribute set ID')); - } - - return $setId; - } - - /** - * Remove Attribute Set - * - * @param int|string $entityTypeId - * @param int|string $id - * @return $this - */ - public function removeAttributeSet($entityTypeId, $id) - { - $this->deleteTableRow('eav_attribute_set', 'attribute_set_id', $this->getAttributeSetId($entityTypeId, $id)); - return $this; - } - - /** - * Set Default Attribute Set to Entity Type - * - * @param int|string $entityType - * @param string $attributeSet - * @return $this - */ - public function setDefaultSetToEntityType($entityType, $attributeSet = 'Default') - { - $entityTypeId = $this->getEntityTypeId($entityType); - $setId = $this->getAttributeSetId($entityTypeId, $attributeSet); - $this->updateEntityType($entityTypeId, 'default_attribute_set_id', $setId); - return $this; - } - - /** - * Get identifiers of all attribute sets - * - * @param int|string|null $entityTypeId - * @return array - */ - public function getAllAttributeSetIds($entityTypeId = null) - { - $select = $this->getConnection()->select()->from($this->getTable('eav_attribute_set'), 'attribute_set_id'); - - $bind = []; - if ($entityTypeId !== null) { - $bind['entity_type_id'] = $this->getEntityTypeId($entityTypeId); - $select->where('entity_type_id = :entity_type_id'); - } - - return $this->getConnection()->fetchCol($select, $bind); - } - - /** - * Retrieve Default Attribute Set for Entity Type - * - * @param string|int $entityType - * @return int - */ - public function getDefaultAttributeSetId($entityType) - { - $bind = ['entity_type' => $entityType]; - if (is_numeric($entityType)) { - $where = 'entity_type_id = :entity_type'; - } else { - $where = 'entity_type_code = :entity_type'; - } - $select = $this->getConnection()->select()->from( - $this->getTable('eav_entity_type'), - 'default_attribute_set_id' - )->where( - $where - ); - - return $this->getConnection()->fetchOne($select, $bind); - } - - /******************* ATTRIBUTE GROUPS *****************/ - - /** - * Retrieve Attribute Group Sort order - * - * @param int|string $entityTypeId - * @param int|string $setId - * @param int $sortOrder - * @return int - */ - public function getAttributeGroupSortOrder($entityTypeId, $setId, $sortOrder = null) - { - if (!is_numeric($sortOrder)) { - $bind = ['attribute_set_id' => $this->getAttributeSetId($entityTypeId, $setId)]; - $select = $this->getConnection()->select()->from( - $this->getTable('eav_attribute_group'), - 'MAX(sort_order)' - )->where( - 'attribute_set_id = :attribute_set_id' - ); - - $sortOrder = $this->getConnection()->fetchOne($select, $bind) + 1; - } - - return $sortOrder; - } - - /** - * Add Attribute Group - * - * @param int|string $entityTypeId - * @param int|string $setId - * @param string $name - * @param int $sortOrder - * @return $this - */ - public function addAttributeGroup($entityTypeId, $setId, $name, $sortOrder = null) - { - $setId = $this->getAttributeSetId($entityTypeId, $setId); - $data = ['attribute_set_id' => $setId, 'attribute_group_name' => $name]; - - if (isset($this->defaultGroupIdAssociations[$name])) { - $data['default_id'] = $this->defaultGroupIdAssociations[$name]; - } - - if ($sortOrder !== null) { - $data['sort_order'] = $sortOrder; - } - - $groupId = $this->getAttributeGroup($entityTypeId, $setId, $name, 'attribute_group_id'); - if ($groupId) { - $this->updateAttributeGroup($entityTypeId, $setId, $groupId, $data); - } else { - if ($sortOrder === null) { - $data['sort_order'] = $this->getAttributeGroupSortOrder($entityTypeId, $setId, $sortOrder); - } - $this->getConnection()->insert($this->getTable('eav_attribute_group'), $data); - } - - return $this; - } - - /** - * Update Attribute Group Data - * - * @param int|string $entityTypeId - * @param int|string $setId - * @param int|string $id - * @param string $field - * @param mixed $value - * @return $this - */ - public function updateAttributeGroup($entityTypeId, $setId, $id, $field, $value = null) - { - $this->updateTableRow( - 'eav_attribute_group', - 'attribute_group_id', - $this->getAttributeGroupId($entityTypeId, $setId, $id), - $field, - $value, - 'attribute_set_id', - $this->getAttributeSetId($entityTypeId, $setId) - ); - - return $this; - } - - /** - * Retrieve Attribute Group Data - * - * @param int|string $entityTypeId - * @param int|string $setId - * @param int|string $id - * @param string $field - * @return mixed - */ - public function getAttributeGroup($entityTypeId, $setId, $id, $field = null) - { - $searchId = $id; - if (is_numeric($id)) { - $searchField = 'attribute_group_id'; - } else { - if (isset($this->defaultGroupIdAssociations[$id])) { - $searchField = 'default_id'; - $searchId = $this->defaultGroupIdAssociations[$id]; - } else { - $searchField = 'attribute_group_name'; - } - } - - return $this->getTableRow( - 'eav_attribute_group', - $searchField, - $searchId, - $field, - 'attribute_set_id', - $this->getAttributeSetId($entityTypeId, $setId) - ); - } - - /** - * Retrieve Attribute Group Id by Id or Name - * - * @param int|string $entityTypeId - * @param int|string $setId - * @param int|string $groupId - * @return $this - */ - public function getAttributeGroupId($entityTypeId, $setId, $groupId) - { - if (!is_numeric($groupId)) { - $groupId = $this->getAttributeGroup($entityTypeId, $setId, $groupId, 'attribute_group_id'); - } - - if (!is_numeric($groupId)) { - $groupId = $this->getDefaultAttributeGroupId($entityTypeId, $setId); - } - - if (!is_numeric($groupId)) { - throw new \Magento\Eav\Exception(__('Wrong attribute group ID')); - } - return $groupId; - } - - /** - * Remove Attribute Group By Id or Name - * - * @param int|string $entityTypeId - * @param int|string $setId - * @param int|string $id - * @return $this - */ - public function removeAttributeGroup($entityTypeId, $setId, $id) - { - $this->deleteTableRow( - 'eav_attribute_group', - 'attribute_group_id', - $this->getAttributeGroupId($entityTypeId, $setId, $id) - ); - return $this; - } - - /** - * Retrieve Default Attribute Group Id By Entity Type and Attribute Set - * - * @param string|int $entityType - * @param int $attributeSetId - * @return int - */ - public function getDefaultAttributeGroupId($entityType, $attributeSetId = null) - { - $entityType = $this->getEntityTypeId($entityType); - if (!is_numeric($attributeSetId)) { - $attributeSetId = $this->getDefaultAttributeSetId($entityType); - } - $bind = ['attribute_set_id' => $attributeSetId]; - $select = $this->getConnection()->select()->from( - $this->getTable('eav_attribute_group'), - 'attribute_group_id' - )->where( - 'attribute_set_id = :attribute_set_id' - )->order( - ['default_id ' . \Magento\Framework\DB\Select::SQL_DESC, 'sort_order'] - )->limit( - 1 - ); - - return $this->getConnection()->fetchOne($select, $bind); - } - - /** - * Get number of all attributes in group - * - * @param int|string $entityTypeId - * @param int|string $setId - * @param int|string $groupId - * - * @return string - */ - public function getAttributesNumberInGroup($entityTypeId, $setId, $groupId) - { - $select = $this->getConnection()->select()->from( - $this->getTable('eav_entity_attribute'), - ['count' => 'COUNT(*)'] - )->where( - 'attribute_group_id = ?', - $this->getAttributeGroupId($entityTypeId, $setId, $groupId) - )->where( - 'entity_type_id = ?', - $entityTypeId - )->where( - 'attribute_set_id = ?', - $setId - ); - - return $this->getConnection()->fetchOne($select); - } - - /******************* ATTRIBUTES *****************/ - - /** - * Retrieve value from array by key or return default value - * - * @param array $array - * @param string $key - * @param string $default - * @return string - */ - protected function _getValue($array, $key, $default = null) - { - if (isset($array[$key]) && is_bool($array[$key])) { - $array[$key] = (int)$array[$key]; - } - return isset($array[$key]) ? $array[$key] : $default; - } - - /** - * Validate attribute data before insert into table - * - * @param array $data - * @return true - * @throws \Magento\Eav\Exception - */ - protected function _validateAttributeData($data) - { - $attributeCodeMaxLength = \Magento\Eav\Model\Entity\Attribute::ATTRIBUTE_CODE_MAX_LENGTH; - - if (isset( - $data['attribute_code'] - ) && !\Zend_Validate::is( - $data['attribute_code'], - 'StringLength', - ['max' => $attributeCodeMaxLength] - ) - ) { - throw new \Magento\Eav\Exception( - __('Maximum length of attribute code must be less than %1 symbols', $attributeCodeMaxLength) - ); - } - - return true; - } - - /** - * Add attribute to an entity type - * - * If attribute is system will add to all existing attribute sets - * - * @param string|integer $entityTypeId - * @param string $code - * @param array $attr - * @return $this - */ - public function addAttribute($entityTypeId, $code, array $attr) - { - $entityTypeId = $this->getEntityTypeId($entityTypeId); - - $data = array_replace( - ['entity_type_id' => $entityTypeId, 'attribute_code' => $code], - $this->attributeMapper->map($attr, $entityTypeId) - ); - - $this->_validateAttributeData($data); - - $sortOrder = isset($attr['sort_order']) ? $attr['sort_order'] : null; - $attributeId = $this->getAttribute($entityTypeId, $code, 'attribute_id'); - if ($attributeId) { - $this->updateAttribute($entityTypeId, $attributeId, $data, null, $sortOrder); - } else { - $this->_insertAttribute($data); - } - - if (!empty($attr['group']) || empty($attr['user_defined'])) { - $select = $this->getConnection()->select()->from( - $this->getTable('eav_attribute_set') - )->where( - 'entity_type_id = :entity_type_id' - ); - $sets = $this->getConnection()->fetchAll($select, ['entity_type_id' => $entityTypeId]); - foreach ($sets as $set) { - if (!empty($attr['group'])) { - $this->addAttributeGroup($entityTypeId, $set['attribute_set_id'], $attr['group']); - $this->addAttributeToSet( - $entityTypeId, - $set['attribute_set_id'], - $attr['group'], - $code, - $sortOrder - ); - } else { - $this->addAttributeToSet( - $entityTypeId, - $set['attribute_set_id'], - $this->_generalGroupName, - $code, - $sortOrder - ); - } - } - } - - if (isset($attr['option']) && is_array($attr['option'])) { - $option = $attr['option']; - $option['attribute_id'] = $this->getAttributeId($entityTypeId, $code); - $this->addAttributeOption($option); - } - - return $this; - } - - /** - * Add Attribure Option - * - * @param array $option - * @return void - * @throws \Magento\Framework\Model\Exception - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - */ - public function addAttributeOption($option) - { - $optionTable = $this->getTable('eav_attribute_option'); - $optionValueTable = $this->getTable('eav_attribute_option_value'); - - if (isset($option['value'])) { - foreach ($option['value'] as $optionId => $values) { - $intOptionId = (int)$optionId; - if (!empty($option['delete'][$optionId])) { - if ($intOptionId) { - $condition = ['option_id =?' => $intOptionId]; - $this->getConnection()->delete($optionTable, $condition); - } - continue; - } - - if (!$intOptionId) { - $data = [ - 'attribute_id' => $option['attribute_id'], - 'sort_order' => isset($option['order'][$optionId]) ? $option['order'][$optionId] : 0, - ]; - $this->getConnection()->insert($optionTable, $data); - $intOptionId = $this->getConnection()->lastInsertId($optionTable); - } else { - $data = [ - 'sort_order' => isset($option['order'][$optionId]) ? $option['order'][$optionId] : 0, - ]; - $this->getConnection()->update($optionTable, $data, ['option_id=?' => $intOptionId]); - } - - // Default value - if (!isset($values[0])) { - throw new \Magento\Framework\Model\Exception(__('Default option value is not defined')); - } - $condition = ['option_id =?' => $intOptionId]; - $this->getConnection()->delete($optionValueTable, $condition); - foreach ($values as $storeId => $value) { - $data = ['option_id' => $intOptionId, 'store_id' => $storeId, 'value' => $value]; - $this->getConnection()->insert($optionValueTable, $data); - } - } - } elseif (isset($option['values'])) { - foreach ($option['values'] as $sortOrder => $label) { - // add option - $data = ['attribute_id' => $option['attribute_id'], 'sort_order' => $sortOrder]; - $this->getConnection()->insert($optionTable, $data); - $intOptionId = $this->getConnection()->lastInsertId($optionTable); - - $data = ['option_id' => $intOptionId, 'store_id' => 0, 'value' => $label]; - $this->getConnection()->insert($optionValueTable, $data); - } - } - } - - /** - * Update Attribute data and Attribute additional data - * - * @param int|string $entityTypeId - * @param int|string $id - * @param string $field - * @param mixed $value - * @param int $sortOrder - * @return $this - */ - public function updateAttribute($entityTypeId, $id, $field, $value = null, $sortOrder = null) - { - $this->_updateAttribute($entityTypeId, $id, $field, $value, $sortOrder); - $this->_updateAttributeAdditionalData($entityTypeId, $id, $field, $value); - return $this; - } - - /** - * Update Attribute data - * - * @param int|string $entityTypeId - * @param int|string $id - * @param string $field - * @param mixed $value - * @param int $sortOrder - * @return $this - */ - protected function _updateAttribute($entityTypeId, $id, $field, $value = null, $sortOrder = null) - { - if ($sortOrder !== null) { - $this->updateTableRow( - 'eav_entity_attribute', - 'attribute_id', - $this->getAttributeId($entityTypeId, $id), - 'sort_order', - $sortOrder - ); - } - - $attributeFields = $this->_getAttributeTableFields(); - if (is_array($field)) { - $bind = []; - foreach ($field as $k => $v) { - if (isset($attributeFields[$k])) { - $bind[$k] = $this->getConnection()->prepareColumnValue($attributeFields[$k], $v); - } - } - if (!$bind) { - return $this; - } - $field = $bind; - } else { - if (!isset($attributeFields[$field])) { - return $this; - } - } - - $this->updateTableRow( - 'eav_attribute', - 'attribute_id', - $this->getAttributeId($entityTypeId, $id), - $field, - $value, - 'entity_type_id', - $this->getEntityTypeId($entityTypeId) - ); - - return $this; - } - - /** - * Update Attribute Additional data - * - * @param int|string $entityTypeId - * @param int|string $id - * @param string $field - * @param mixed $value - * @return $this - */ - protected function _updateAttributeAdditionalData($entityTypeId, $id, $field, $value = null) - { - $additionalTable = $this->getEntityType($entityTypeId, 'additional_attribute_table'); - if (!$additionalTable) { - return $this; - } - $additionalTableExists = $this->getConnection()->isTableExists($this->getTable($additionalTable)); - if ($additionalTable && $additionalTableExists) { - $attributeFields = $this->getConnection()->describeTable($this->getTable($additionalTable)); - if (is_array($field)) { - $bind = []; - foreach ($field as $k => $v) { - if (isset($attributeFields[$k])) { - $bind[$k] = $this->getConnection()->prepareColumnValue($attributeFields[$k], $v); - } - } - if (!$bind) { - return $this; - } - $field = $bind; - } else { - if (!isset($attributeFields[$field])) { - return $this; - } - } - $this->updateTableRow( - $this->getTable($additionalTable), - 'attribute_id', - $this->getAttributeId($entityTypeId, $id), - $field, - $value - ); - } - - return $this; - } - - /** - * Retrieve Attribute Data By Id or Code - * - * @param int|string $entityTypeId - * @param int|string $id - * @param string $field - * @return mixed - */ - public function getAttribute($entityTypeId, $id, $field = null) - { - $additionalTable = $this->getEntityType($entityTypeId, 'additional_attribute_table'); - $entityTypeId = $this->getEntityTypeId($entityTypeId); - $idField = is_numeric($id) ? 'attribute_id' : 'attribute_code'; - if (!$additionalTable) { - return $this->getTableRow('eav_attribute', $idField, $id, $field, 'entity_type_id', $entityTypeId); - } - - $mainTable = $this->getTable('eav_attribute'); - if (empty($this->_setupCache[$mainTable][$entityTypeId][$id])) { - $additionalTable = $this->getTable($additionalTable); - $bind = ['id' => $id, 'entity_type_id' => $entityTypeId]; - $select = $this->getConnection()->select()->from( - ['main' => $mainTable] - )->join( - ['additional' => $additionalTable], - 'main.attribute_id = additional.attribute_id' - )->where( - "main.{$idField} = :id" - )->where( - 'main.entity_type_id = :entity_type_id' - ); - - $row = $this->getConnection()->fetchRow($select, $bind); - if (!$row) { - $this->_setupCache[$mainTable][$entityTypeId][$id] = false; - } else { - $this->_setupCache[$mainTable][$entityTypeId][$row['attribute_id']] = $row; - $this->_setupCache[$mainTable][$entityTypeId][$row['attribute_code']] = $row; - } - } - - $row = $this->_setupCache[$mainTable][$entityTypeId][$id]; - if ($field !== null) { - return isset($row[$field]) ? $row[$field] : false; - } - - return $row; - } - - /** - * Retrieve Attribute Id Data By Id or Code - * - * @param int|string $entityTypeId - * @param int|string $id - * @return int - */ - public function getAttributeId($entityTypeId, $id) - { - if (!is_numeric($id)) { - $id = $this->getAttribute($entityTypeId, $id, 'attribute_id'); - } - if (!is_numeric($id)) { - return false; - } - return $id; - } - - /** - * Return table name for eav attribute - * - * @param int|string $entityTypeId Entity Type id or Entity Type code - * @param int|string $id Attribute id or Attribute code - * @return string - */ - public function getAttributeTable($entityTypeId, $id) - { - $entityKeyName = is_numeric($entityTypeId) ? 'entity_type_id' : 'entity_type_code'; - $attributeKeyName = is_numeric($id) ? 'attribute_id' : 'attribute_code'; - - $bind = ['id' => $id, 'entity_type_id' => $entityTypeId]; - $select = $this->getConnection()->select()->from( - ['entity_type' => $this->getTable('eav_entity_type')], - ['entity_table'] - )->join( - ['attribute' => $this->getTable('eav_attribute')], - 'attribute.entity_type_id = entity_type.entity_type_id', - ['backend_type'] - )->where( - "entity_type.{$entityKeyName} = :entity_type_id" - )->where( - "attribute.{$attributeKeyName} = :id" - )->limit( - 1 - ); - - $result = $this->getConnection()->fetchRow($select, $bind); - if ($result) { - $table = $this->getTable($result['entity_table']); - if ($result['backend_type'] != 'static') { - $table .= '_' . $result['backend_type']; - } - return $table; - } - - return false; - } - - /** - * Remove Attribute - * - * @param int|string $entityTypeId - * @param int|string $code - * @return $this - */ - public function removeAttribute($entityTypeId, $code) - { - $mainTable = $this->getTable('eav_attribute'); - $attribute = $this->getAttribute($entityTypeId, $code); - if ($attribute) { - $this->deleteTableRow('eav_attribute', 'attribute_id', $attribute['attribute_id']); - if (isset($this->_setupCache[$mainTable][$attribute['entity_type_id']][$attribute['attribute_code']])) { - unset($this->_setupCache[$mainTable][$attribute['entity_type_id']][$attribute['attribute_code']]); - } - } - return $this; - } - - /** - * Retrieve Attribute Sort Order - * - * @param int|string $entityTypeId - * @param int|string $setId - * @param int|string $groupId - * @param int $sortOrder - * @return $this - */ - public function getAttributeSortOrder($entityTypeId, $setId, $groupId, $sortOrder = null) - { - if (!is_numeric($sortOrder)) { - $bind = ['attribute_group_id' => $this->getAttributeGroupId($entityTypeId, $setId, $groupId)]; - $select = $this->getConnection()->select()->from( - $this->getTable('eav_entity_attribute'), - 'MAX(sort_order)' - )->where( - 'attribute_group_id = :attribute_group_id' - ); - - $sortOrder = $this->getConnection()->fetchOne($select, $bind) + 1; - } - - return $sortOrder; - } - - /** - * Add Attribute to All Groups on Attribute Set - * - * @param int|string $entityTypeId - * @param int|string $setId - * @param int|string $groupId - * @param int|string $attributeId - * @param int $sortOrder - * @return $this - */ - public function addAttributeToSet($entityTypeId, $setId, $groupId, $attributeId, $sortOrder = null) - { - $entityTypeId = $this->getEntityTypeId($entityTypeId); - $setId = $this->getAttributeSetId($entityTypeId, $setId); - $groupId = $this->getAttributeGroupId($entityTypeId, $setId, $groupId); - $attributeId = $this->getAttributeId($entityTypeId, $attributeId); - $table = $this->getTable('eav_entity_attribute'); - - $bind = ['attribute_set_id' => $setId, 'attribute_id' => $attributeId]; - $select = $this->getConnection()->select()->from( - $table - )->where( - 'attribute_set_id = :attribute_set_id' - )->where( - 'attribute_id = :attribute_id' - ); - $result = $this->getConnection()->fetchRow($select, $bind); - - if ($result) { - if ($result['attribute_group_id'] != $groupId) { - $where = ['entity_attribute_id =?' => $result['entity_attribute_id']]; - $data = ['attribute_group_id' => $groupId]; - $this->getConnection()->update($table, $data, $where); - } - } else { - $data = [ - 'entity_type_id' => $entityTypeId, - 'attribute_set_id' => $setId, - 'attribute_group_id' => $groupId, - 'attribute_id' => $attributeId, - 'sort_order' => $this->getAttributeSortOrder($entityTypeId, $setId, $groupId, $sortOrder), - ]; - - $this->getConnection()->insert($table, $data); - } - - return $this; - } - - /** - * Add or update attribute to group - * - * @param int|string $entityType - * @param int|string $setId - * @param int|string $groupId - * @param int|string $attributeId - * @param int $sortOrder - * @return $this - */ - public function addAttributeToGroup($entityType, $setId, $groupId, $attributeId, $sortOrder = null) - { - $entityType = $this->getEntityTypeId($entityType); - $setId = $this->getAttributeSetId($entityType, $setId); - $groupId = $this->getAttributeGroupId($entityType, $setId, $groupId); - $attributeId = $this->getAttributeId($entityType, $attributeId); - - $data = [ - 'entity_type_id' => $entityType, - 'attribute_set_id' => $setId, - 'attribute_group_id' => $groupId, - 'attribute_id' => $attributeId, - ]; - - $bind = ['entity_type_id' => $entityType, 'attribute_set_id' => $setId, 'attribute_id' => $attributeId]; - $select = $this->getConnection()->select()->from( - $this->getTable('eav_entity_attribute') - )->where( - 'entity_type_id = :entity_type_id' - )->where( - 'attribute_set_id = :attribute_set_id' - )->where( - 'attribute_id = :attribute_id' - ); - $row = $this->getConnection()->fetchRow($select, $bind); - if ($row) { - // update - if ($sortOrder !== null) { - $data['sort_order'] = $sortOrder; - } - - $this->getConnection()->update( - $this->getTable('eav_entity_attribute'), - $data, - $this->getConnection()->quoteInto('entity_attribute_id=?', $row['entity_attribute_id']) - ); - } else { - if ($sortOrder === null) { - $select = $this->getConnection()->select()->from( - $this->getTable('eav_entity_attribute'), - 'MAX(sort_order)' - )->where( - 'entity_type_id = :entity_type_id' - )->where( - 'attribute_set_id = :attribute_set_id' - )->where( - 'attribute_id = :attribute_id' - ); - - $sortOrder = $this->getConnection()->fetchOne($select, $bind) + 10; - } - $sortOrder = is_numeric($sortOrder) ? $sortOrder : 1; - $data['sort_order'] = $sortOrder; - $this->getConnection()->insert($this->getTable('eav_entity_attribute'), $data); - } - - return $this; - } - - /******************* BULK INSTALL *****************/ - - /** - * Install entities - * - * @param array $entities - * @return $this - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function installEntities($entities = null) - { - $this->cleanCache(); - - if ($entities === null) { - $entities = $this->getDefaultEntities(); - } - - foreach ($entities as $entityName => $entity) { - $this->addEntityType($entityName, $entity); - - $frontendPrefix = isset($entity['frontend_prefix']) ? $entity['frontend_prefix'] : ''; - $backendPrefix = isset($entity['backend_prefix']) ? $entity['backend_prefix'] : ''; - $sourcePrefix = isset($entity['source_prefix']) ? $entity['source_prefix'] : ''; - - if (is_array($entity['attributes']) && !empty($entity['attributes'])) { - foreach ($entity['attributes'] as $attrCode => $attr) { - if (!empty($attr['backend'])) { - if ('_' === $attr['backend']) { - $attr['backend'] = $backendPrefix; - } elseif ('_' === $attr['backend'][0]) { - $attr['backend'] = $backendPrefix . $attr['backend']; - } else { - $attr['backend'] = $attr['backend']; - } - } - if (!empty($attr['frontend'])) { - if ('_' === $attr['frontend']) { - $attr['frontend'] = $frontendPrefix; - } elseif ('_' === $attr['frontend'][0]) { - $attr['frontend'] = $frontendPrefix . $attr['frontend']; - } else { - $attr['frontend'] = $attr['frontend']; - } - } - if (!empty($attr['source'])) { - if ('_' === $attr['source']) { - $attr['source'] = $sourcePrefix; - } elseif ('_' === $attr['source'][0]) { - $attr['source'] = $sourcePrefix . $attr['source']; - } else { - $attr['source'] = $attr['source']; - } - } - - $this->addAttribute($entityName, $attrCode, $attr); - } - } - $this->setDefaultSetToEntityType($entityName); - } - - return $this; - } - - /** - * Retrieve attribute table fields - * - * @return array - */ - protected function _getAttributeTableFields() - { - return $this->getConnection()->describeTable($this->getTable('eav_attribute')); - } - - /** - * Insert attribute and filter data - * - * @param array $data - * @return $this - */ - protected function _insertAttribute(array $data) - { - $bind = []; - - $fields = $this->_getAttributeTableFields(); - - foreach ($data as $k => $v) { - if (isset($fields[$k])) { - $bind[$k] = $this->getConnection()->prepareColumnValue($fields[$k], $v); - } - } - if (!$bind) { - return $this; - } - - $this->getConnection()->insert($this->getTable('eav_attribute'), $bind); - $attributeId = $this->getConnection()->lastInsertId($this->getTable('eav_attribute')); - $this->_insertAttributeAdditionalData( - $data['entity_type_id'], - array_merge(['attribute_id' => $attributeId], $data) - ); - - return $this; - } - - /** - * Insert attribute additional data - * - * @param int|string $entityTypeId - * @param array $data - * @return $this - */ - protected function _insertAttributeAdditionalData($entityTypeId, array $data) - { - $additionalTable = $this->getEntityType($entityTypeId, 'additional_attribute_table'); - if (!$additionalTable) { - return $this; - } - $additionalTableExists = $this->getConnection()->isTableExists($this->getTable($additionalTable)); - if ($additionalTable && $additionalTableExists) { - $bind = []; - $fields = $this->getConnection()->describeTable($this->getTable($additionalTable)); - foreach ($data as $k => $v) { - if (isset($fields[$k])) { - $bind[$k] = $this->getConnection()->prepareColumnValue($fields[$k], $v); - } - } - if (!$bind) { - return $this; - } - $this->getConnection()->insert($this->getTable($additionalTable), $bind); - } - - return $this; - } -} diff --git a/app/code/Magento/Eav/Setup/Eav.php b/app/code/Magento/Eav/Setup/EavSetup.php similarity index 99% rename from app/code/Magento/Eav/Setup/Eav.php rename to app/code/Magento/Eav/Setup/EavSetup.php index b2abdebb5cffe..1578f24d8c707 100644 --- a/app/code/Magento/Eav/Setup/Eav.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Eav\Setup; + use Magento\Eav\Model\Entity\Setup\Context; use Magento\Eav\Model\Entity\Setup\PropertyMapperInterface; use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; @@ -13,7 +14,7 @@ /** * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) */ -class Eav +class EavSetup { /** * @var CacheInterface diff --git a/app/code/Magento/Eav/Setup/InstallData.php b/app/code/Magento/Eav/Setup/InstallData.php new file mode 100644 index 0000000000000..b675d3b9489ea --- /dev/null +++ b/app/code/Magento/Eav/Setup/InstallData.php @@ -0,0 +1,107 @@ +eavSetupFactory = $eavSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + $setup->startSetup(); + /** @var \Magento\Framework\Module\Setup\Migration $migrationSetup */ + $migrationSetup = $setup->createMigrationSetup(); + + $migrationSetup->appendClassAliasReplace( + 'eav_attribute', + 'attribute_model', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['attribute_id'] + ); + $migrationSetup->appendClassAliasReplace( + 'eav_attribute', + 'backend_model', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['attribute_id'] + ); + $migrationSetup->appendClassAliasReplace( + 'eav_attribute', + 'frontend_model', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['attribute_id'] + ); + $migrationSetup->appendClassAliasReplace( + 'eav_attribute', + 'source_model', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['attribute_id'] + ); + + $migrationSetup->appendClassAliasReplace( + 'eav_entity_type', + 'entity_model', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['entity_type_id'] + ); + $migrationSetup->appendClassAliasReplace( + 'eav_entity_type', + 'attribute_model', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['entity_type_id'] + ); + $migrationSetup->appendClassAliasReplace( + 'eav_entity_type', + 'increment_model', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['entity_type_id'] + ); + $migrationSetup->appendClassAliasReplace( + 'eav_entity_type', + 'entity_attribute_collection', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_RESOURCE, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['entity_type_id'] + ); + + $migrationSetup->doUpdateClassAliases(); + + /** @var \Magento\Eav\Setup\EavSetup $eavSetup */ + $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); + $groups = $eavSetup->getAttributeGroupCollectionFactory(); + foreach ($groups as $group) { + /** @var $group \Magento\Eav\Model\Entity\Attribute\Group*/ + $group->save(); + } + + $setup->endSetup(); + } +} diff --git a/app/code/Magento/Eav/data/eav_setup/data-upgrade-2.0.0.php b/app/code/Magento/Eav/data/eav_setup/data-upgrade-2.0.0.php deleted file mode 100644 index f0becffd5f833..0000000000000 --- a/app/code/Magento/Eav/data/eav_setup/data-upgrade-2.0.0.php +++ /dev/null @@ -1,80 +0,0 @@ -startSetup(); -/** @var \Magento\Framework\Module\Setup\Migration $migrationSetup */ -$migrationSetup = $installer->createMigrationSetup(); - -$migrationSetup->appendClassAliasReplace( - 'eav_attribute', - 'attribute_model', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['attribute_id'] -); -$migrationSetup->appendClassAliasReplace( - 'eav_attribute', - 'backend_model', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['attribute_id'] -); -$migrationSetup->appendClassAliasReplace( - 'eav_attribute', - 'frontend_model', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['attribute_id'] -); -$migrationSetup->appendClassAliasReplace( - 'eav_attribute', - 'source_model', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['attribute_id'] -); - -$migrationSetup->appendClassAliasReplace( - 'eav_entity_type', - 'entity_model', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['entity_type_id'] -); -$migrationSetup->appendClassAliasReplace( - 'eav_entity_type', - 'attribute_model', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['entity_type_id'] -); -$migrationSetup->appendClassAliasReplace( - 'eav_entity_type', - 'increment_model', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['entity_type_id'] -); -$migrationSetup->appendClassAliasReplace( - 'eav_entity_type', - 'entity_attribute_collection', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_RESOURCE, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['entity_type_id'] -); - -$migrationSetup->doUpdateClassAliases(); - -/** @var $groups \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection*/ -$groups = $installer->getAttributeGroupCollectionFactory(); -foreach ($groups as $group) { - /** @var $group \Magento\Eav\Model\Entity\Attribute\Group*/ - $group->save(); -} - -$installer->endSetup(); diff --git a/app/code/Magento/Eav/etc/di.xml b/app/code/Magento/Eav/etc/di.xml index 309cb0cf327c4..42c3fc13ef7d9 100644 --- a/app/code/Magento/Eav/etc/di.xml +++ b/app/code/Magento/Eav/etc/di.xml @@ -33,13 +33,6 @@ eav - - - - Magento\Eav\Model\Entity\Setup - - - diff --git a/app/code/Magento/GiftMessage/Model/Resource/Setup.php b/app/code/Magento/GiftMessage/Model/Resource/Setup.php deleted file mode 100644 index b46e462f24639..0000000000000 --- a/app/code/Magento/GiftMessage/Model/Resource/Setup.php +++ /dev/null @@ -1,90 +0,0 @@ -catalogSetupFactory = $catalogSetupFactory; - $this->quoteSetupFactory = $quoteSetupFactory; - $this->salesSetupFactory = $salesSetupFactory; - parent::__construct( - $context, - $resourceName, - $moduleName, - $connectionName - ); - } - - /** - * Create Quote Setup Factory for GiftMessage - * - * @param array $data - * @return \Magento\Quote\Model\Resource\Setup - */ - public function createQuoteSetup(array $data = []) - { - return $this->quoteSetupFactory->create($data); - } - - /** - * Create Sales Setup Factory for GiftMessage - * - * @param array $data - * @return \Magento\Sales\Model\Resource\Setup - */ - public function createSalesSetup(array $data = []) - { - return $this->salesSetupFactory->create($data); - } - - /** - * Create Catalog Setup Factory for GiftMessage - * - * @param array $data - * @return \Magento\Catalog\Model\Resource\Setup - */ - public function createCatalogSetup(array $data = []) - { - return $this->catalogSetupFactory->create($data); - } -} diff --git a/app/code/Magento/GiftMessage/Setup/InstallData.php b/app/code/Magento/GiftMessage/Setup/InstallData.php new file mode 100644 index 0000000000000..6c01c9ed0853a --- /dev/null +++ b/app/code/Magento/GiftMessage/Setup/InstallData.php @@ -0,0 +1,116 @@ +categorySetupFactory = $categorySetupFactory; + $this->quoteSetupFactory = $quoteSetupFactory; + $this->salesSetupFactory = $salesSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** + * Add 'gift_message_id' attributes for entities + */ + $options = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'visible' => false, 'required' => false]; + $entities = ['quote', 'quote_address', 'quote_item', 'quote_address_item']; + foreach ($entities as $entity) { + /** @var \Magento\Quote\Setup\QuoteSetup $quoteSetup */ + $quoteSetup = $this->quoteSetupFactory->create(['setup' => $setup]); + $quoteSetup->addAttribute($entity, 'gift_message_id', $options); + } + + /** @var \Magento\Sales\Setup\SalesSetup $salesSetup */ + $salesSetup = $this->salesSetupFactory->create(['setup' => $setup]); + $salesSetup->addAttribute('order', 'gift_message_id', $options); + $salesSetup->addAttribute('order_item', 'gift_message_id', $options); + /** + * Add 'gift_message_available' attributes for entities + */ + $salesSetup->addAttribute('order_item', 'gift_message_available', $options); + + /** @var \Magento\Catalog\Setup\CategorySetup $catalogSetup */ + $catalogSetup = $this->categorySetupFactory->create(['setup' => $setup]); + $catalogSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'gift_message_available', + [ + 'group' => 'Gift Options', + 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Boolean', + 'frontend' => '', + 'label' => 'Allow Gift Message', + 'input' => 'select', + 'class' => '', + 'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean', + 'global' => true, + 'visible' => true, + 'required' => false, + 'user_defined' => false, + 'default' => '', + 'apply_to' => '', + 'input_renderer' => 'Magento\GiftMessage\Block\Adminhtml\Product\Helper\Form\Config', + 'visible_on_front' => false + ] + ); + + $groupName = 'Autosettings'; + $entityTypeId = $catalogSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); + $attributeSetId = $catalogSetup->getAttributeSetId($entityTypeId, 'Default'); + + $attribute = $catalogSetup->getAttribute($entityTypeId, 'gift_message_available'); + if ($attribute) { + $catalogSetup->addAttributeToGroup( + $entityTypeId, + $attributeSetId, + $groupName, + $attribute['attribute_id'], + 60 + ); + } + + if (!$catalogSetup->getAttributesNumberInGroup($entityTypeId, $attributeSetId, 'Gift Options')) { + $catalogSetup->removeAttributeGroup($entityTypeId, $attributeSetId, 'Gift Options'); + } + } +} diff --git a/app/code/Magento/GiftMessage/data/giftmessage_setup/data-install-2.0.0.php b/app/code/Magento/GiftMessage/data/giftmessage_setup/data-install-2.0.0.php deleted file mode 100644 index 80b59718e63a5..0000000000000 --- a/app/code/Magento/GiftMessage/data/giftmessage_setup/data-install-2.0.0.php +++ /dev/null @@ -1,64 +0,0 @@ - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'visible' => false, 'required' => false]; -$entities = ['quote', 'quote_address', 'quote_item', 'quote_address_item']; -foreach ($entities as $entity) { - $installer->createQuoteSetup( - ['resourceName' => 'quote_setup'] - )->addAttribute($entity, 'gift_message_id', $options); -} - -$salesSetup = $installer->createSalesSetup(['resourceName' => 'sales_setup']); -$salesSetup->addAttribute('order', 'gift_message_id', $options); -$salesSetup->addAttribute('order_item', 'gift_message_id', $options); -/** - * Add 'gift_message_available' attributes for entities - */ -$salesSetup->addAttribute('order_item', 'gift_message_available', $options); - -$catalogSetup = $installer->createCatalogSetup(['resourceName' => 'catalog_setup']); -$catalogSetup->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'gift_message_available', - [ - 'group' => 'Gift Options', - 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Boolean', - 'frontend' => '', - 'label' => 'Allow Gift Message', - 'input' => 'select', - 'class' => '', - 'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean', - 'global' => true, - 'visible' => true, - 'required' => false, - 'user_defined' => false, - 'default' => '', - 'apply_to' => '', - 'input_renderer' => 'Magento\GiftMessage\Block\Adminhtml\Product\Helper\Form\Config', - 'visible_on_front' => false - ] -); -/** @var $this \Magento\GiftMessage\Model\Resource\Setup */ - -$groupName = 'Autosettings'; -$entityTypeId = $catalogSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); -$attributeSetId = $catalogSetup->getAttributeSetId($entityTypeId, 'Default'); - -$attribute = $catalogSetup->getAttribute($entityTypeId, 'gift_message_available'); -if ($attribute) { - $catalogSetup->addAttributeToGroup($entityTypeId, $attributeSetId, $groupName, $attribute['attribute_id'], 60); -} - -if (!$catalogSetup->getAttributesNumberInGroup($entityTypeId, $attributeSetId, 'Gift Options')) { - $catalogSetup->removeAttributeGroup($entityTypeId, $attributeSetId, 'Gift Options'); -} diff --git a/app/code/Magento/GiftMessage/etc/di.xml b/app/code/Magento/GiftMessage/etc/di.xml index f49fdfcd4b5c4..2c674334652ef 100644 --- a/app/code/Magento/GiftMessage/etc/di.xml +++ b/app/code/Magento/GiftMessage/etc/di.xml @@ -6,13 +6,6 @@ */ --> - - - - Magento\GiftMessage\Model\Resource\Setup - - - diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Setup.php b/app/code/Magento/GoogleShopping/Model/Resource/Setup.php deleted file mode 100644 index 152a2e666eddf..0000000000000 --- a/app/code/Magento/GoogleShopping/Model/Resource/Setup.php +++ /dev/null @@ -1,50 +0,0 @@ -_configFactory = $configFactory; - $this->moduleManager = $moduleManager; - parent::__construct($context, $resourceName, $moduleName, $connectionName); - } - - /** - * @return \Magento\Framework\Module\Manager - */ - public function getModuleManager() - { - return $this->moduleManager; - } -} diff --git a/app/code/Magento/GoogleShopping/data/googleshopping_setup/data-install-2.0.0.php b/app/code/Magento/GoogleShopping/data/googleshopping_setup/data-install-2.0.0.php deleted file mode 100644 index 675b335e1a090..0000000000000 --- a/app/code/Magento/GoogleShopping/data/googleshopping_setup/data-install-2.0.0.php +++ /dev/null @@ -1,47 +0,0 @@ -getModuleManager()->isEnabled('Magento_GoogleBase')) { - $typesInsert = $installer->getConnection()->select()->from( - $installer->getTable('googlebase_types'), - ['type_id', 'attribute_set_id', 'target_country', 'category' => new \Zend_Db_Expr('NULL')] - )->insertFromSelect( - $installer->getTable('googleshopping_types') - ); - - $itemsInsert = $installer->getConnection()->select()->from( - $installer->getTable('googlebase_items'), - ['item_id', 'type_id', 'product_id', 'gbase_item_id', 'store_id', 'published', 'expires'] - )->insertFromSelect( - $installer->getTable('googleshopping_items') - ); - - $attributes = ''; - foreach ($this->_configFactory->create()->getAttributes() as $destAttribtues) { - foreach ($destAttribtues as $code => $info) { - $attributes .= "'{$code}',"; - } - } - $attributes = rtrim($attributes, ','); - $attributesInsert = $installer->getConnection()->select()->from( - $installer->getTable('googlebase_attributes'), - [ - 'id', - 'attribute_id', - 'gbase_attribute' => new \Zend_Db_Expr("IF(gbase_attribute IN ({$attributes}), gbase_attribute, '')"), - 'type_id' - ] - )->insertFromSelect( - $installer->getTable('googleshopping_attributes') - ); - - $installer->run($typesInsert); - $installer->run($attributesInsert); - $installer->run($itemsInsert); -} diff --git a/app/code/Magento/GoogleShopping/etc/di.xml b/app/code/Magento/GoogleShopping/etc/di.xml index 28c64f937041e..1ad6d40c0809e 100644 --- a/app/code/Magento/GoogleShopping/etc/di.xml +++ b/app/code/Magento/GoogleShopping/etc/di.xml @@ -16,11 +16,4 @@ Magento\GoogleShopping\Model\Resource\Helper - - - - Magento\GoogleShopping\Model\Resource\Setup - - - diff --git a/app/code/Magento/GroupedProduct/Setup/InstallData.php b/app/code/Magento/GroupedProduct/Setup/InstallData.php new file mode 100644 index 0000000000000..f60daca9b4e2b --- /dev/null +++ b/app/code/Magento/GroupedProduct/Setup/InstallData.php @@ -0,0 +1,85 @@ +eavSetupFactory = $eavSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** + * Install grouped product link type + */ + $data = [ + 'link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, + 'code' => 'super', + ]; + $setup->getConnection() + ->insertOnDuplicate($setup->getTable('catalog_product_link_type'), $data); + + /** + * Install grouped product link attributes + */ + $select = $setup->getConnection() + ->select() + ->from( + ['c' => $setup->getTable('catalog_product_link_attribute')] + ) + ->where( + "c.link_type_id=?", + \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED + ); + $result = $setup->getConnection()->fetchAll($select); + + if (!$result) { + $data = [ + [ + 'link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, + 'product_link_attribute_code' => 'position', + 'data_type' => 'int', + ], + [ + 'link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, + 'product_link_attribute_code' => 'qty', + 'data_type' => 'decimal' + ], + ]; + + $setup->getConnection()->insertMultiple($setup->getTable('catalog_product_link_attribute'), $data); + } + + /** @var EavSetup $eavSetup */ + $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); + $field = 'country_of_manufacture'; + $applyTo = explode(',', $eavSetup->getAttribute(Product::ENTITY, $field, 'apply_to')); + if (!in_array('grouped', $applyTo)) { + $applyTo[] = 'grouped'; + $eavSetup->updateAttribute(Product::ENTITY, $field, 'apply_to', implode(',', $applyTo)); + } + } +} diff --git a/app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-2.0.0.php b/app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-2.0.0.php deleted file mode 100644 index 22ac2a8f5e2c7..0000000000000 --- a/app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-2.0.0.php +++ /dev/null @@ -1,56 +0,0 @@ - \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, - 'code' => 'super', -]; -$installer->getConnection() - ->insertOnDuplicate($installer->getTable('catalog_product_link_type'), $data); - -/** - * Install grouped product link attributes - */ -$select = $installer->getConnection() - ->select() - ->from( - ['c' => $installer->getTable('catalog_product_link_attribute')] - ) - ->where( - "c.link_type_id=?", - \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED - ); -$result = $installer->getConnection()->fetchAll($select); - -if (!$result) { - $data = [ - [ - 'link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, - 'product_link_attribute_code' => 'position', - 'data_type' => 'int', - ], - [ - 'link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, - 'product_link_attribute_code' => 'qty', - 'data_type' => 'decimal' - ], - ]; - - $installer->getConnection()->insertMultiple($installer->getTable('catalog_product_link_attribute'), $data); -} - -$field = 'country_of_manufacture'; -$applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')); -if (!in_array('grouped', $applyTo)) { - $applyTo[] = 'grouped'; - $installer->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to', implode(',', $applyTo)); -} diff --git a/app/code/Magento/GroupedProduct/etc/di.xml b/app/code/Magento/GroupedProduct/etc/di.xml index b63434c152b9f..638f2ef823288 100644 --- a/app/code/Magento/GroupedProduct/etc/di.xml +++ b/app/code/Magento/GroupedProduct/etc/di.xml @@ -6,13 +6,6 @@ */ --> - - - - Magento\Catalog\Model\Resource\Setup - - - diff --git a/app/code/Magento/Msrp/Setup/InstallData.php b/app/code/Magento/Msrp/Setup/InstallData.php new file mode 100644 index 0000000000000..e97d9e767688e --- /dev/null +++ b/app/code/Magento/Msrp/Setup/InstallData.php @@ -0,0 +1,92 @@ +eavSetupFactory = $eavSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var EavSetup $eavSetup */ + $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); + + $productTypes = [ + \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE, + \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL, + \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE, + \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE, + ]; + $productTypes = join(',', $productTypes); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'msrp', + [ + 'group' => 'Advanced Pricing', + 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Price', + 'frontend' => '', + 'label' => 'Manufacturer\'s Suggested Retail Price', + 'type' => 'decimal', + 'input' => 'price', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, + 'visible' => true, + 'required' => false, + 'user_defined' => false, + 'apply_to' => $productTypes, + 'input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type', + 'frontend_input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type', + 'visible_on_front' => false, + 'used_in_product_listing' => true + ] + ); + + $eavSetup->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'msrp_display_actual_price_type', + [ + 'group' => 'Advanced Pricing', + 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Boolean', + 'frontend' => '', + 'label' => 'Display Actual Price', + 'input' => 'select', + 'source' => 'Magento\Msrp\Model\Product\Attribute\Source\Type\Price', + 'source_model' => 'Magento\Msrp\Model\Product\Attribute\Source\Type\Price', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, + 'visible' => true, + 'required' => false, + 'user_defined' => false, + 'default' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::TYPE_USE_CONFIG, + 'default_value' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::TYPE_USE_CONFIG, + 'apply_to' => $productTypes, + 'input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type\Price', + 'frontend_input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type\Price', + 'visible_on_front' => false, + 'used_in_product_listing' => true + ] + ); + } +} diff --git a/app/code/Magento/Msrp/data/msrp_setup/data-install-2.0.0.php b/app/code/Magento/Msrp/data/msrp_setup/data-install-2.0.0.php deleted file mode 100644 index 010d8a1d049b5..0000000000000 --- a/app/code/Magento/Msrp/data/msrp_setup/data-install-2.0.0.php +++ /dev/null @@ -1,63 +0,0 @@ -addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'msrp', - [ - 'group' => 'Advanced Pricing', - 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Price', - 'frontend' => '', - 'label' => 'Manufacturer\'s Suggested Retail Price', - 'type' => 'decimal', - 'input' => 'price', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, - 'visible' => true, - 'required' => false, - 'user_defined' => false, - 'apply_to' => $productTypes, - 'input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type', - 'frontend_input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type', - 'visible_on_front' => false, - 'used_in_product_listing' => true - ] -); - -$installer->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'msrp_display_actual_price_type', - [ - 'group' => 'Advanced Pricing', - 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Boolean', - 'frontend' => '', - 'label' => 'Display Actual Price', - 'input' => 'select', - 'source' => 'Magento\Msrp\Model\Product\Attribute\Source\Type\Price', - 'source_model' => 'Magento\Msrp\Model\Product\Attribute\Source\Type\Price', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, - 'visible' => true, - 'required' => false, - 'user_defined' => false, - 'default' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::TYPE_USE_CONFIG, - 'default_value' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::TYPE_USE_CONFIG, - 'apply_to' => $productTypes, - 'input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type\Price', - 'frontend_input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type\Price', - 'visible_on_front' => false, - 'used_in_product_listing' => true - ] -); diff --git a/app/code/Magento/Msrp/etc/di.xml b/app/code/Magento/Msrp/etc/di.xml index b6cf072d14259..869c2044d3b13 100644 --- a/app/code/Magento/Msrp/etc/di.xml +++ b/app/code/Magento/Msrp/etc/di.xml @@ -30,13 +30,6 @@ - - - - Magento\Catalog\Model\Resource\Setup - - - diff --git a/app/code/Magento/Quote/Setup/InstallData.php b/app/code/Magento/Quote/Setup/InstallData.php new file mode 100644 index 0000000000000..9bb7a78b4d607 --- /dev/null +++ b/app/code/Magento/Quote/Setup/InstallData.php @@ -0,0 +1,51 @@ +quoteSetupFactory = $setupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var QuoteSetup $quoteSetup */ + $quoteSetup = $this->quoteSetupFactory->create(); + + /** + * Install eav entity types to the eav/entity_type table + */ + $attributes = [ + 'vat_id' => ['type' => Table::TYPE_TEXT], + 'vat_is_valid' => ['type' => Table::TYPE_SMALLINT], + 'vat_request_id' => ['type' => Table::TYPE_TEXT], + 'vat_request_date' => ['type' => Table::TYPE_TEXT], + 'vat_request_success' => ['type' => Table::TYPE_SMALLINT], + ]; + + foreach ($attributes as $attributeCode => $attributeParams) { + $quoteSetup->addAttribute('quote_address', $attributeCode, $attributeParams); + } + } +} diff --git a/app/code/Magento/Quote/Model/Resource/Setup.php b/app/code/Magento/Quote/Setup/QuoteSetup.php similarity index 71% rename from app/code/Magento/Quote/Model/Resource/Setup.php rename to app/code/Magento/Quote/Setup/QuoteSetup.php index 8a63c491146d1..3e4a3fdeab18d 100644 --- a/app/code/Magento/Quote/Model/Resource/Setup.php +++ b/app/code/Magento/Quote/Setup/QuoteSetup.php @@ -3,16 +3,22 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Quote\Model\Resource; +namespace Magento\Quote\Setup; + +use Magento\Eav\Model\Entity\Setup\Context; +use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; +use Magento\Eav\Setup\EavSetup; +use Magento\Framework\App\CacheInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\Setup\ModuleDataResourceInterface; /** - * Setup Model of Sales Module + * Setup Model of Quote Module */ -class Setup extends \Magento\Eav\Model\Entity\Setup +class QuoteSetup extends EavSetup { /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var ScopeConfigInterface */ protected $_config; @@ -22,33 +28,22 @@ class Setup extends \Magento\Eav\Model\Entity\Setup protected $_encryptor; /** - * @param \Magento\Eav\Model\Entity\Setup\Context $context - * @param string $resourceName - * @param \Magento\Framework\App\CacheInterface $cache - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory - * @param \Magento\Framework\App\Config\ScopeConfigInterface $config - * @param string $moduleName - * @param string $connectionName + * @param ModuleDataResourceInterface $setup + * @param Context $context + * @param CacheInterface $cache + * @param CollectionFactory $attrGroupCollectionFactory + * @param ScopeConfigInterface $config */ public function __construct( - \Magento\Eav\Model\Entity\Setup\Context $context, - $resourceName, - \Magento\Framework\App\CacheInterface $cache, - \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, - \Magento\Framework\App\Config\ScopeConfigInterface $config, - $moduleName = 'Magento_Quote', - $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION + ModuleDataResourceInterface $setup, + Context $context, + CacheInterface $cache, + CollectionFactory $attrGroupCollectionFactory, + ScopeConfigInterface $config ) { $this->_config = $config; $this->_encryptor = $context->getEncryptor(); - parent::__construct( - $context, - $resourceName, - $cache, - $attrGroupCollectionFactory, - $moduleName, - $connectionName - ); + parent::__construct($setup, $context, $cache, $attrGroupCollectionFactory); } /** @@ -73,8 +68,8 @@ public function __construct( */ protected function _flatTableExist($table) { - $tablesList = $this->getConnection()->listTables(); - return in_array(strtoupper($this->getTable($table)), array_map('strtoupper', $tablesList)); + $tablesList = $this->getSetup()->getConnection()->listTables(); + return in_array(strtoupper($this->getSetup()->getTable($table)), array_map('strtoupper', $tablesList)); } /** @@ -110,12 +105,16 @@ public function addAttribute($entityTypeId, $code, array $attr) */ protected function _addFlatAttribute($table, $attribute, $attr) { - $tableInfo = $this->getConnection()->describeTable($this->getTable($table)); + $tableInfo = $this->getSetup()->getConnection()->describeTable($this->getSetup()->getTable($table)); if (isset($tableInfo[$attribute])) { return $this; } $columnDefinition = $this->_getAttributeColumnDefinition($attribute, $attr); - $this->getConnection()->addColumn($this->getTable($table), $attribute, $columnDefinition); + $this->getSetup()->getConnection()->addColumn( + $this->getSetup()->getTable($table), + $attribute, + $columnDefinition + ); return $this; } @@ -169,7 +168,7 @@ protected function _getAttributeColumnDefinition($code, $data) /** * Get config model * - * @return \Magento\Framework\App\Config\ScopeConfigInterface + * @return ScopeConfigInterface */ public function getConfigModel() { diff --git a/app/code/Magento/Quote/data/quote_setup/data-install-2.0.0.php b/app/code/Magento/Quote/data/quote_setup/data-install-2.0.0.php deleted file mode 100644 index a2103b219e048..0000000000000 --- a/app/code/Magento/Quote/data/quote_setup/data-install-2.0.0.php +++ /dev/null @@ -1,23 +0,0 @@ - ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT], - 'vat_is_valid' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT], - 'vat_request_id' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT], - 'vat_request_date' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT], - 'vat_request_success' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT], -]; - -foreach ($attributes as $attributeCode => $attributeParams) { - $this->addAttribute('quote_address', $attributeCode, $attributeParams); -} diff --git a/app/code/Magento/Reports/Model/Resource/Setup.php b/app/code/Magento/Reports/Model/Resource/Setup.php deleted file mode 100644 index aaf6257c6a097..0000000000000 --- a/app/code/Magento/Reports/Model/Resource/Setup.php +++ /dev/null @@ -1,46 +0,0 @@ -_pageFactory = $pageFactory; - } - - /** - * @return \Magento\Cms\Model\Page - */ - public function getPage() - { - return $this->_pageFactory->create(); - } -} diff --git a/app/code/Magento/Reports/Setup/InstallData.php b/app/code/Magento/Reports/Setup/InstallData.php new file mode 100644 index 0000000000000..0c5b234d5df11 --- /dev/null +++ b/app/code/Magento/Reports/Setup/InstallData.php @@ -0,0 +1,87 @@ +pageFactory = $pageFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + $setup->startSetup(); + /* + * Report Event Types default data + */ + $eventTypeData = [ + [ + 'event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_VIEW, + 'event_name' => 'catalog_product_view' + ], + ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_SEND, 'event_name' => 'sendfriend_product'], + [ + 'event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_COMPARE, + 'event_name' => 'catalog_product_compare_add_product' + ], + [ + 'event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_TO_CART, + 'event_name' => 'checkout_cart_add_product' + ], + [ + 'event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_TO_WISHLIST, + 'event_name' => 'wishlist_add_product' + ], + ['event_type_id' => \Magento\Reports\Model\Event::EVENT_WISHLIST_SHARE, 'event_name' => 'wishlist_share'], + ]; + + foreach ($eventTypeData as $row) { + $setup->getConnection() + ->insertForce($setup->getTable('report_event_types'), $row); + } + + /** + * Prepare database after data upgrade + */ + $setup->endSetup(); + + /** + * Cms Page with 'home' identifier page modification for report pages + */ + /** @var $cms \Magento\Cms\Model\Page */ + $cms = $this->pageFactory->create(); + $cms->load('home', 'identifier'); + + $reportLayoutUpdate = ''; + + /* + * Merge and save old layout update data with report layout data + */ + $cms->setLayoutUpdateXml($cms->getLayoutUpdateXml() . $reportLayoutUpdate) + ->save(); + } +} diff --git a/app/code/Magento/Reports/data/reports_setup/data-install-2.0.0.php b/app/code/Magento/Reports/data/reports_setup/data-install-2.0.0.php deleted file mode 100644 index 1273bbcde6890..0000000000000 --- a/app/code/Magento/Reports/data/reports_setup/data-install-2.0.0.php +++ /dev/null @@ -1,63 +0,0 @@ -startSetup(); -/* - * Report Event Types default data - */ -$eventTypeData = [ - ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_VIEW, 'event_name' => 'catalog_product_view'], - ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_SEND, 'event_name' => 'sendfriend_product'], - [ - 'event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_COMPARE, - 'event_name' => 'catalog_product_compare_add_product' - ], - [ - 'event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_TO_CART, - 'event_name' => 'checkout_cart_add_product' - ], - [ - 'event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_TO_WISHLIST, - 'event_name' => 'wishlist_add_product' - ], - ['event_type_id' => \Magento\Reports\Model\Event::EVENT_WISHLIST_SHARE, 'event_name' => 'wishlist_share'], -]; - -foreach ($eventTypeData as $row) { - $installer->getConnection() - ->insertForce($installer->getTable('report_event_types'), $row); -} - -/** - * Prepare database after data upgrade - */ -$installer->endSetup(); - -/** - * Cms Page with 'home' identifier page modification for report pages - */ -/** @var $cms \Magento\Cms\Model\Page */ -$cms = $installer->getPage() - ->load('home', 'identifier'); - -$reportLayoutUpdate = ''; - -/* - * Merge and save old layout update data with report layout data - */ -$cms->setLayoutUpdateXml($cms->getLayoutUpdateXml() . $reportLayoutUpdate) - ->save(); diff --git a/app/code/Magento/Reports/etc/di.xml b/app/code/Magento/Reports/etc/di.xml index 418ec59435a1e..dee2319661d68 100644 --- a/app/code/Magento/Reports/etc/di.xml +++ b/app/code/Magento/Reports/etc/di.xml @@ -9,13 +9,6 @@ - - - - Magento\Reports\Model\Resource\Setup - - - reports diff --git a/app/code/Magento/Sales/Setup/InstallData.php b/app/code/Magento/Sales/Setup/InstallData.php new file mode 100644 index 0000000000000..9df310c140d40 --- /dev/null +++ b/app/code/Magento/Sales/Setup/InstallData.php @@ -0,0 +1,149 @@ +salesSetupFactory = $salesSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var \Magento\Sales\Setup\SalesSetup $salesSetup */ + $salesSetup = $this->salesSetupFactory->create(); + + /** + * Install eav entity types to the eav/entity_type table + */ + $salesSetup->installEntities(); + + /** + * Install order statuses from config + */ + $data = []; + $statuses = [ + 'pending' => __('Pending'), + 'pending_payment' => __('Pending Payment'), + 'processing' => __('Processing'), + 'holded' => __('On Hold'), + 'complete' => __('Complete'), + 'closed' => __('Closed'), + 'canceled' => __('Canceled'), + 'fraud' => __('Suspected Fraud'), + 'payment_review' => __('Payment Review'), + ]; + foreach ($statuses as $code => $info) { + $data[] = ['status' => $code, 'label' => $info]; + } + $setup->getConnection()->insertArray($setup->getTable('sales_order_status'), ['status', 'label'], $data); + + /** + * Install order states from config + */ + $data = []; + $states = [ + 'new' => [ + 'label' => __('New'), + 'statuses' => ['pending' => ['default' => '1']], + 'visible_on_front' => true, + ], + 'pending_payment' => [ + 'label' => __('Pending Payment'), + 'statuses' => ['pending_payment' => ['default' => '1']], + ], + 'processing' => [ + 'label' => __('Processing'), + 'statuses' => ['processing' => ['default' => '1']], + 'visible_on_front' => true, + ], + 'complete' => [ + 'label' => __('Complete'), + 'statuses' => ['complete' => ['default' => '1']], + 'visible_on_front' => true, + ], + 'closed' => [ + 'label' => __('Closed'), + 'statuses' => ['closed' => ['default' => '1']], + 'visible_on_front' => true, + ], + 'canceled' => [ + 'label' => __('Canceled'), + 'statuses' => ['canceled' => ['default' => '1']], + 'visible_on_front' => true, + ], + 'holded' => [ + 'label' => __('On Hold'), + 'statuses' => ['holded' => ['default' => '1']], + 'visible_on_front' => true, + ], + 'payment_review' => [ + 'label' => __('Payment Review'), + 'statuses' => ['payment_review' => ['default' => '1'], 'fraud' => []], + 'visible_on_front' => true, + ], + ]; + + foreach ($states as $code => $info) { + if (isset($info['statuses'])) { + foreach ($info['statuses'] as $status => $statusInfo) { + $data[] = [ + 'status' => $status, + 'state' => $code, + 'is_default' => is_array($statusInfo) && isset($statusInfo['default']) ? 1 : 0, + ]; + } + } + } + $setup->getConnection()->insertArray( + $setup->getTable('sales_order_status_state'), + ['status', 'state', 'is_default'], + $data + ); + + $entitiesToAlter = ['order_address']; + + $attributes = [ + 'vat_id' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT], + 'vat_is_valid' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT], + 'vat_request_id' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT], + 'vat_request_date' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT], + 'vat_request_success' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT], + ]; + + foreach ($entitiesToAlter as $entityName) { + foreach ($attributes as $attributeCode => $attributeParams) { + $salesSetup->addAttribute($entityName, $attributeCode, $attributeParams); + } + } + + /** Update visibility for states */ + $states = ['new', 'processing', 'complete', 'closed', 'canceled', 'holded', 'payment_review']; + foreach ($states as $state) { + $setup->getConnection()->update( + $setup->getTable('sales_order_status_state'), + ['visible_on_front' => 1], + ['state = ?' => $state] + ); + } + } +} diff --git a/app/code/Magento/Sales/Model/Resource/Setup.php b/app/code/Magento/Sales/Setup/SalesSetup.php similarity index 76% rename from app/code/Magento/Sales/Model/Resource/Setup.php rename to app/code/Magento/Sales/Setup/SalesSetup.php index 10569012ea9f3..964cb68f1a5db 100644 --- a/app/code/Magento/Sales/Model/Resource/Setup.php +++ b/app/code/Magento/Sales/Setup/SalesSetup.php @@ -3,52 +3,47 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Sales\Model\Resource; +namespace Magento\Sales\Setup; + +use Magento\Eav\Model\Entity\Setup\Context; +use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; +use Magento\Framework\App\CacheInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Setup Model of Sales Module */ -class Setup extends \Magento\Eav\Model\Entity\Setup +class SalesSetup extends \Magento\Eav\Setup\EavSetup { /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var ScopeConfigInterface */ - protected $_config; + protected $config; /** - * @var \Magento\Framework\Encryption\EncryptorInterface + * @var EncryptorInterface */ - protected $_encryptor; + protected $encryptor; /** - * @param \Magento\Eav\Model\Entity\Setup\Context $context - * @param string $resourceName - * @param \Magento\Framework\App\CacheInterface $cache - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory - * @param \Magento\Framework\App\Config\ScopeConfigInterface $config - * @param string $moduleName - * @param string $connectionName + * @param ModuleDataResourceInterface $setup + * @param Context $context + * @param CacheInterface $cache + * @param CollectionFactory $attrGroupCollectionFactory + * @param ScopeConfigInterface $config */ public function __construct( - \Magento\Eav\Model\Entity\Setup\Context $context, - $resourceName, - \Magento\Framework\App\CacheInterface $cache, - \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, - \Magento\Framework\App\Config\ScopeConfigInterface $config, - $moduleName = 'Magento_Sales', - $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION + ModuleDataResourceInterface $setup, + Context $context, + CacheInterface $cache, + CollectionFactory $attrGroupCollectionFactory, + ScopeConfigInterface $config ) { - $this->_config = $config; - $this->_encryptor = $context->getEncryptor(); - parent::__construct( - $context, - $resourceName, - $cache, - $attrGroupCollectionFactory, - $moduleName, - $connectionName - ); + $this->config = $config; + $this->encryptor = $context->getEncryptor(); + parent::__construct($setup, $context, $cache, $attrGroupCollectionFactory); } /** @@ -89,8 +84,8 @@ public function __construct( */ protected function _flatTableExist($table) { - $tablesList = $this->getConnection()->listTables(); - return in_array(strtoupper($this->getTable($table)), array_map('strtoupper', $tablesList)); + $tablesList = $this->getSetup()->getConnection()->listTables(); + return in_array(strtoupper($this->getSetup()->getTable($table)), array_map('strtoupper', $tablesList)); } /** @@ -127,12 +122,15 @@ public function addAttribute($entityTypeId, $code, array $attr) */ protected function _addFlatAttribute($table, $attribute, $attr) { - $tableInfo = $this->getConnection()->describeTable($this->getTable($table)); + $tableInfo = $this->getSetup()->getConnection()->describeTable($this->getSetup()->getTable($table)); if (isset($tableInfo[$attribute])) { return $this; } $columnDefinition = $this->_getAttributeColumnDefinition($attribute, $attr); - $this->getConnection()->addColumn($this->getTable($table), $attribute, $columnDefinition); + $this->getSetup()->getConnection()->addColumn( + $this->getSetup()->getTable($table), + $attribute, $columnDefinition + ); return $this; } @@ -149,7 +147,11 @@ protected function _addGridAttribute($table, $attribute, $attr, $entityTypeId) { if (in_array($entityTypeId, $this->_flatEntitiesGrid) && !empty($attr['grid'])) { $columnDefinition = $this->_getAttributeColumnDefinition($attribute, $attr); - $this->getConnection()->addColumn($this->getTable($table . '_grid'), $attribute, $columnDefinition); + $this->getSetup()->getConnection()->addColumn( + $this->getSetup()->getTable($table . '_grid'), + $attribute, + $columnDefinition + ); } return $this; } @@ -244,18 +246,18 @@ public function getDefaultEntities() /** * Get config model * - * @return \Magento\Framework\App\Config\ScopeConfigInterface + * @return ScopeConfigInterface */ public function getConfigModel() { - return $this->_config; + return $this->config; } /** - * @return \Magento\Framework\Encryption\EncryptorInterface + * @return EncryptorInterface */ public function getEncryptor() { - return $this->_encryptor; + return $this->encryptor; } } diff --git a/app/code/Magento/Sales/data/sales_setup/data-install-2.0.0.php b/app/code/Magento/Sales/data/sales_setup/data-install-2.0.0.php deleted file mode 100644 index 2ebea1a5eefca..0000000000000 --- a/app/code/Magento/Sales/data/sales_setup/data-install-2.0.0.php +++ /dev/null @@ -1,121 +0,0 @@ -installEntities(); - -/** - * Install order statuses from config - */ -$data = []; -$statuses = [ - 'pending' => __('Pending'), - 'pending_payment' => __('Pending Payment'), - 'processing' => __('Processing'), - 'holded' => __('On Hold'), - 'complete' => __('Complete'), - 'closed' => __('Closed'), - 'canceled' => __('Canceled'), - 'fraud' => __('Suspected Fraud'), - 'payment_review' => __('Payment Review'), -]; -foreach ($statuses as $code => $info) { - $data[] = ['status' => $code, 'label' => $info]; -} -$this->getConnection()->insertArray($this->getTable('sales_order_status'), ['status', 'label'], $data); - -/** - * Install order states from config - */ -$data = []; -$states = [ - 'new' => [ - 'label' => __('New'), - 'statuses' => ['pending' => ['default' => '1']], - 'visible_on_front' => true, - ], - 'pending_payment' => [ - 'label' => __('Pending Payment'), - 'statuses' => ['pending_payment' => ['default' => '1']], - ], - 'processing' => [ - 'label' => __('Processing'), - 'statuses' => ['processing' => ['default' => '1']], - 'visible_on_front' => true, - ], - 'complete' => [ - 'label' => __('Complete'), - 'statuses' => ['complete' => ['default' => '1']], - 'visible_on_front' => true, - ], - 'closed' => [ - 'label' => __('Closed'), - 'statuses' => ['closed' => ['default' => '1']], - 'visible_on_front' => true, - ], - 'canceled' => [ - 'label' => __('Canceled'), - 'statuses' => ['canceled' => ['default' => '1']], - 'visible_on_front' => true, - ], - 'holded' => [ - 'label' => __('On Hold'), - 'statuses' => ['holded' => ['default' => '1']], - 'visible_on_front' => true, - ], - 'payment_review' => [ - 'label' => __('Payment Review'), - 'statuses' => ['payment_review' => ['default' => '1'], 'fraud' => []], - 'visible_on_front' => true, - ], -]; - -foreach ($states as $code => $info) { - if (isset($info['statuses'])) { - foreach ($info['statuses'] as $status => $statusInfo) { - $data[] = [ - 'status' => $status, - 'state' => $code, - 'is_default' => is_array($statusInfo) && isset($statusInfo['default']) ? 1 : 0, - ]; - } - } -} -$this->getConnection()->insertArray( - $this->getTable('sales_order_status_state'), - ['status', 'state', 'is_default'], - $data -); - -$entitiesToAlter = ['order_address']; - -$attributes = [ - 'vat_id' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT], - 'vat_is_valid' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT], - 'vat_request_id' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT], - 'vat_request_date' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT], - 'vat_request_success' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT], -]; - -foreach ($entitiesToAlter as $entityName) { - foreach ($attributes as $attributeCode => $attributeParams) { - $this->addAttribute($entityName, $attributeCode, $attributeParams); - } -} - -/** Update visibility for states */ -$states = ['new', 'processing', 'complete', 'closed', 'canceled', 'holded', 'payment_review']; -foreach ($states as $state) { - $this->getConnection()->update( - $this->getTable('sales_order_status_state'), - ['visible_on_front' => 1], - ['state = ?' => $state] - ); -} diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index 0073993b204c8..ce41a5bd24663 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -100,13 +100,6 @@ - - - - Magento\Sales\Model\Resource\Setup - - - diff --git a/app/code/Magento/Tax/Model/Resource/Setup.php b/app/code/Magento/Tax/Model/Resource/Setup.php deleted file mode 100644 index d28abe213f39b..0000000000000 --- a/app/code/Magento/Tax/Model/Resource/Setup.php +++ /dev/null @@ -1,91 +0,0 @@ -_setupFactory = $setupFactory; - $this->productTypeConfig = $productTypeConfig; - parent::__construct( - $context, - $resourceName, - $cache, - $attrGroupCollectionFactory, - $config, - $moduleName, - $connectionName - ); - } - - /** - * Load Tax Table Data - * - * @param string $table - * @return array - */ - protected function _loadTableData($table) - { - $table = $this->getTable($table); - $select = $this->getConnection()->select(); - $select->from($table); - return $this->getConnection()->fetchAll($select); - } - - /** - * @param array $data - * @return \Magento\Catalog\Model\Resource\Setup - */ - public function getCatalogResourceSetup(array $data = []) - { - return $this->_setupFactory->create($data); - } - - /** - * Get taxable product types - * - * @return array - */ - public function getTaxableItems() - { - return $this->productTypeConfig->filter('taxable'); - } -} diff --git a/app/code/Magento/Tax/Setup/InstallData.php b/app/code/Magento/Tax/Setup/InstallData.php new file mode 100644 index 0000000000000..c2f1a2f2ed55b --- /dev/null +++ b/app/code/Magento/Tax/Setup/InstallData.php @@ -0,0 +1,112 @@ +taxSetupFactory = $taxSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var TaxSetup $taxSetup */ + $taxSetup = $this->taxSetupFactory->create(['setup' => $setup]); + + /** + * Add tax_class_id attribute to the 'eav_attribute' table + */ + $catalogInstaller = $taxSetup->getCatalogSetup(['resourceName' => 'catalog_setup']); + $catalogInstaller->addAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'tax_class_id', + [ + 'group' => 'Product Details', + 'sort_order' => 40, + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => 'Tax Class', + 'input' => 'select', + 'class' => '', + 'source' => 'Magento\Tax\Model\TaxClass\Source\Product', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, + 'visible' => true, + 'required' => false, + 'user_defined' => false, + 'default' => '2', + 'searchable' => true, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'visible_in_advanced_search' => true, + 'used_in_product_listing' => true, + 'unique' => false, + 'apply_to' => implode($taxSetup->getTaxableItems(), ',') + ] + ); + + /** + * install tax classes + */ + $data = [ + [ + 'class_id' => 2, + 'class_name' => 'Taxable Goods', + 'class_type' => \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_PRODUCT, + ], + [ + 'class_id' => 3, + 'class_name' => 'Retail Customer', + 'class_type' => \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_CUSTOMER + ], + ]; + foreach ($data as $row) { + $setup->getConnection()->insertForce($setup->getTable('tax_class'), $row); + } + + /** + * install tax calculation rates + */ + $data = [ + [ + 'tax_calculation_rate_id' => 1, + 'tax_country_id' => 'US', + 'tax_region_id' => 12, + 'tax_postcode' => '*', + 'code' => 'US-CA-*-Rate 1', + 'rate' => '8.2500', + ], + [ + 'tax_calculation_rate_id' => 2, + 'tax_country_id' => 'US', + 'tax_region_id' => 43, + 'tax_postcode' => '*', + 'code' => 'US-NY-*-Rate 1', + 'rate' => '8.3750' + ], + ]; + foreach ($data as $row) { + $setup->getConnection()->insertForce($setup->getTable('tax_calculation_rate'), $row); + } + } +} diff --git a/app/code/Magento/Tax/Setup/TaxSetup.php b/app/code/Magento/Tax/Setup/TaxSetup.php new file mode 100644 index 0000000000000..f0dbc19c0a059 --- /dev/null +++ b/app/code/Magento/Tax/Setup/TaxSetup.php @@ -0,0 +1,73 @@ +_setupFactory = $setupFactory; + $this->productTypeConfig = $productTypeConfig; + } + + /** + * @param array $data + * @return CategorySetup + */ + public function getCatalogSetup(array $data = []) + { + return $this->_setupFactory->create($data); + } + + /** + * Get taxable product types + * + * @return array + */ + public function getTaxableItems() + { + return $this->productTypeConfig->filter('taxable'); + } +} diff --git a/app/code/Magento/Tax/data/tax_setup/data-install-2.0.0.php b/app/code/Magento/Tax/data/tax_setup/data-install-2.0.0.php deleted file mode 100644 index 31227d7a599ac..0000000000000 --- a/app/code/Magento/Tax/data/tax_setup/data-install-2.0.0.php +++ /dev/null @@ -1,84 +0,0 @@ -getCatalogResourceSetup(['resourceName' => 'catalog_setup']); -$catalogInstaller->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'tax_class_id', - [ - 'group' => 'Product Details', - 'sort_order' => 40, - 'type' => 'int', - 'backend' => '', - 'frontend' => '', - 'label' => 'Tax Class', - 'input' => 'select', - 'class' => '', - 'source' => 'Magento\Tax\Model\TaxClass\Source\Product', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, - 'visible' => true, - 'required' => false, - 'user_defined' => false, - 'default' => '2', - 'searchable' => true, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'visible_in_advanced_search' => true, - 'used_in_product_listing' => true, - 'unique' => false, - 'apply_to' => implode($this->getTaxableItems(), ',') - ] -); - -/** - * install tax classes - */ -$data = [ - [ - 'class_id' => 2, - 'class_name' => 'Taxable Goods', - 'class_type' => \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_PRODUCT, - ], - [ - 'class_id' => 3, - 'class_name' => 'Retail Customer', - 'class_type' => \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_CUSTOMER - ], -]; -foreach ($data as $row) { - $this->getConnection()->insertForce($this->getTable('tax_class'), $row); -} - -/** - * install tax calculation rates - */ -$data = [ - [ - 'tax_calculation_rate_id' => 1, - 'tax_country_id' => 'US', - 'tax_region_id' => 12, - 'tax_postcode' => '*', - 'code' => 'US-CA-*-Rate 1', - 'rate' => '8.2500', - ], - [ - 'tax_calculation_rate_id' => 2, - 'tax_country_id' => 'US', - 'tax_region_id' => 43, - 'tax_postcode' => '*', - 'code' => 'US-NY-*-Rate 1', - 'rate' => '8.3750' - ], -]; -foreach ($data as $row) { - $this->getConnection()->insertForce($this->getTable('tax_calculation_rate'), $row); -} diff --git a/app/code/Magento/Theme/Model/Resource/Setup.php b/app/code/Magento/Theme/Model/Resource/Setup.php deleted file mode 100644 index 5362ecc887e63..0000000000000 --- a/app/code/Magento/Theme/Model/Resource/Setup.php +++ /dev/null @@ -1,60 +0,0 @@ -_themeResourceFactory = $themeResourceFactory; - $this->_themeFactory = $themeFactory; - parent::__construct($context, $resourceName, $moduleName, $connectionName); - } - - /** - * @return \Magento\Theme\Model\Resource\Theme\Collection - */ - public function createThemeResourceFactory() - { - return $this->_themeResourceFactory->create(); - } - - /** - * @return \Magento\Theme\Model\Theme\Collection - */ - public function createThemeFactory() - { - return $this->_themeFactory->create(); - } -} diff --git a/app/code/Magento/Theme/Setup/InstallData.php b/app/code/Magento/Theme/Setup/InstallData.php new file mode 100644 index 0000000000000..47beadb387fb9 --- /dev/null +++ b/app/code/Magento/Theme/Setup/InstallData.php @@ -0,0 +1,108 @@ +themeResourceFactory = $themeResourceFactory; + $this->themeFactory = $themeFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + $installer = $setup->createMigrationSetup(); + $installer->startSetup(); + + /* + * Register themes + */ + $installer->getEventManager()->dispatch('theme_registration_from_filesystem'); + + /** + * Update theme's data + */ + $fileCollection = $this->createTheme(); + $fileCollection->addDefaultPattern('*'); + $fileCollection->setItemObjectClass('Magento\Theme\Model\Theme\Data'); + + $resourceCollection = $this->createThemeResource(); + $resourceCollection->setItemObjectClass('Magento\Theme\Model\Theme\Data'); + + /** @var $theme \Magento\Framework\View\Design\ThemeInterface */ + foreach ($resourceCollection as $theme) { + $themeType = $fileCollection->hasTheme($theme) + ? \Magento\Framework\View\Design\ThemeInterface::TYPE_PHYSICAL + : \Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL; + $theme->setType($themeType)->save(); + } + + $fileCollection = $this->createTheme(); + $fileCollection->addDefaultPattern('*'); + $fileCollection->setItemObjectClass('Magento\Theme\Model\Theme\Data'); + + $themeDbCollection = $this->createThemeResource(); + $themeDbCollection->setItemObjectClass('Magento\Theme\Model\Theme\Data'); + + /** @var $theme \Magento\Framework\View\Design\ThemeInterface */ + foreach ($fileCollection as $theme) { + $dbTheme = $themeDbCollection->getThemeByFullPath($theme->getFullPath()); + $dbTheme->setCode($theme->getCode()); + $dbTheme->save(); + } + + /** + * Update rows in theme + */ + $installer->getConnection()->update( + $installer->getTable('theme'), + ['area' => 'frontend'], + ['area = ?' => ''] + ); + + $installer->endSetup(); + } + + /** + * @return \Magento\Theme\Model\Resource\Theme\Collection + */ + public function createThemeResource() + { + return $this->themeResourceFactory->create(); + } + + /** + * @return \Magento\Theme\Model\Theme\Collection + */ + public function createTheme() + { + return $this->themeFactory->create(); + } +} diff --git a/app/code/Magento/Theme/data/theme_setup/data-install-2.0.0.php b/app/code/Magento/Theme/data/theme_setup/data-install-2.0.0.php deleted file mode 100644 index 48a2609247b3b..0000000000000 --- a/app/code/Magento/Theme/data/theme_setup/data-install-2.0.0.php +++ /dev/null @@ -1,57 +0,0 @@ -createMigrationSetup(); -$installer->startSetup(); - -/* - * Register themes - */ -$installer->getEventManager()->dispatch('theme_registration_from_filesystem'); - -/** - * Update theme's data - */ -$fileCollection = $this->createThemeFactory(); -$fileCollection->addDefaultPattern('*'); -$fileCollection->setItemObjectClass('Magento\Theme\Model\Theme\Data'); - -$resourceCollection = $this->createThemeResourceFactory(); -$resourceCollection->setItemObjectClass('Magento\Theme\Model\Theme\Data'); - -/** @var $theme \Magento\Framework\View\Design\ThemeInterface */ -foreach ($resourceCollection as $theme) { - $themeType = $fileCollection->hasTheme($theme) - ? \Magento\Framework\View\Design\ThemeInterface::TYPE_PHYSICAL - : \Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL; - $theme->setType($themeType)->save(); -} - -$fileCollection = $this->createThemeFactory(); -$fileCollection->addDefaultPattern('*'); -$fileCollection->setItemObjectClass('Magento\Theme\Model\Theme\Data'); - -$themeDbCollection = $this->createThemeResourceFactory(); -$themeDbCollection->setItemObjectClass('Magento\Theme\Model\Theme\Data'); - -/** @var $theme \Magento\Framework\View\Design\ThemeInterface */ -foreach ($fileCollection as $theme) { - $dbTheme = $themeDbCollection->getThemeByFullPath($theme->getFullPath()); - $dbTheme->setCode($theme->getCode()); - $dbTheme->save(); -} - -/** - * Update rows in theme - */ -$installer->getConnection()->update( - $installer->getTable('theme'), - ['area' => 'frontend'], - ['area = ?' => ''] -); - -$installer->endSetup(); diff --git a/app/code/Magento/Theme/etc/di.xml b/app/code/Magento/Theme/etc/di.xml index f7444ee959e32..dc3e240d1cf13 100644 --- a/app/code/Magento/Theme/etc/di.xml +++ b/app/code/Magento/Theme/etc/di.xml @@ -50,13 +50,6 @@ deployed_version.txt - - - - Magento\Theme\Model\Resource\Setup - - - diff --git a/app/code/Magento/Weee/Model/Resource/Setup.php b/app/code/Magento/Weee/Model/Resource/Setup.php deleted file mode 100644 index cf1646f9a3fa6..0000000000000 --- a/app/code/Magento/Weee/Model/Resource/Setup.php +++ /dev/null @@ -1,71 +0,0 @@ -salesSetupFactory = $salesSetupFactory; - $this->quoteSetupFactory = $quoteSetupFactory; - parent::__construct( - $context, - $resourceName, - $moduleName, - $connectionName - ); - } - - /** - * Create Sales Setup - * - * @param array $data - * @return \Magento\Sales\Model\Resource\Setup - */ - public function createSalesSetup(array $data) - { - return $this->salesSetupFactory->create($data); - } - - /** - * Create Quote Setup - * - * @param array $data - * @return \Magento\Quote\Model\Resource\Setup - */ - public function createQuoteSetup(array $data) - { - return $this->quoteSetupFactory->create($data); - } -} diff --git a/app/code/Magento/Weee/Setup/InstallData.php b/app/code/Magento/Weee/Setup/InstallData.php new file mode 100644 index 0000000000000..a3ca65707bdf7 --- /dev/null +++ b/app/code/Magento/Weee/Setup/InstallData.php @@ -0,0 +1,90 @@ +salesSetupFactory = $salesSetupFactory; + $this->quoteSetupFactory = $quoteSetupFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + { + /** @var QuoteSetup $quoteSetup */ + $quoteSetup = $this->quoteSetupFactory->create(['setup' => $setup]); + $quoteSetup->addAttribute('quote_item', 'weee_tax_applied', ['type' => 'text']); + $quoteSetup->addAttribute('quote_item', 'weee_tax_applied_amount', ['type' => 'decimal']); + $quoteSetup->addAttribute('quote_item', 'weee_tax_applied_row_amount', ['type' => 'decimal']); + $quoteSetup->addAttribute('quote_item', 'weee_tax_disposition', ['type' => 'decimal']); + $quoteSetup->addAttribute('quote_item', 'weee_tax_row_disposition', ['type' => 'decimal']); + $quoteSetup->addAttribute('quote_item', 'base_weee_tax_applied_amount', ['type' => 'decimal']); + $quoteSetup->addAttribute('quote_item', 'base_weee_tax_applied_row_amnt', ['type' => 'decimal']); + $quoteSetup->addAttribute('quote_item', 'base_weee_tax_disposition', ['type' => 'decimal']); + $quoteSetup->addAttribute('quote_item', 'base_weee_tax_row_disposition', ['type' => 'decimal']); + + + /** @var SalesSetup $salesSetup */ + $salesSetup = $this->salesSetupFactory->create(['setup' => $setup]); + $salesSetup->addAttribute('order_item', 'weee_tax_applied', ['type' => 'text']); + $salesSetup->addAttribute('order_item', 'weee_tax_applied_amount', ['type' => 'decimal']); + $salesSetup->addAttribute('order_item', 'weee_tax_applied_row_amount', ['type' => 'decimal']); + $salesSetup->addAttribute('order_item', 'weee_tax_disposition', ['type' => 'decimal']); + $salesSetup->addAttribute('order_item', 'weee_tax_row_disposition', ['type' => 'decimal']); + $salesSetup->addAttribute('order_item', 'base_weee_tax_applied_amount', ['type' => 'decimal']); + $salesSetup->addAttribute('order_item', 'base_weee_tax_applied_row_amnt', ['type' => 'decimal']); + $salesSetup->addAttribute('order_item', 'base_weee_tax_disposition', ['type' => 'decimal']); + $salesSetup->addAttribute('order_item', 'base_weee_tax_row_disposition', ['type' => 'decimal']); + + $salesSetup->addAttribute('invoice_item', 'weee_tax_applied', ['type' => 'text']); + $salesSetup->addAttribute('invoice_item', 'weee_tax_applied_amount', ['type' => 'decimal']); + $salesSetup->addAttribute('invoice_item', 'weee_tax_applied_row_amount', ['type' => 'decimal']); + $salesSetup->addAttribute('invoice_item', 'weee_tax_disposition', ['type' => 'decimal']); + $salesSetup->addAttribute('invoice_item', 'weee_tax_row_disposition', ['type' => 'decimal']); + $salesSetup->addAttribute('invoice_item', 'base_weee_tax_applied_amount', ['type' => 'decimal']); + $salesSetup->addAttribute('invoice_item', 'base_weee_tax_applied_row_amnt', ['type' => 'decimal']); + $salesSetup->addAttribute('invoice_item', 'base_weee_tax_disposition', ['type' => 'decimal']); + $salesSetup->addAttribute('invoice_item', 'base_weee_tax_row_disposition', ['type' => 'decimal']); + + $salesSetup->addAttribute('creditmemo_item', 'weee_tax_applied', ['type' => 'text']); + $salesSetup->addAttribute('creditmemo_item', 'weee_tax_applied_amount', ['type' => 'decimal']); + $salesSetup->addAttribute('creditmemo_item', 'weee_tax_applied_row_amount', ['type' => 'decimal']); + $salesSetup->addAttribute('creditmemo_item', 'weee_tax_disposition', ['type' => 'decimal']); + $salesSetup->addAttribute('creditmemo_item', 'weee_tax_row_disposition', ['type' => 'decimal']); + $salesSetup->addAttribute('creditmemo_item', 'base_weee_tax_applied_amount', ['type' => 'decimal']); + $salesSetup->addAttribute('creditmemo_item', 'base_weee_tax_applied_row_amnt', ['type' => 'decimal']); + $salesSetup->addAttribute('creditmemo_item', 'base_weee_tax_disposition', ['type' => 'decimal']); + $salesSetup->addAttribute('creditmemo_item', 'base_weee_tax_row_disposition', ['type' => 'decimal']); + } +} diff --git a/app/code/Magento/Weee/data/weee_setup/data-install-2.0.0.php b/app/code/Magento/Weee/data/weee_setup/data-install-2.0.0.php deleted file mode 100644 index 9cf4de4fac7b8..0000000000000 --- a/app/code/Magento/Weee/data/weee_setup/data-install-2.0.0.php +++ /dev/null @@ -1,48 +0,0 @@ -createQuoteSetup(['resourceName' => 'quote_setup']); -$quoteSetup->addAttribute('quote_item', 'weee_tax_applied', ['type' => 'text']); -$quoteSetup->addAttribute('quote_item', 'weee_tax_applied_amount', ['type' => 'decimal']); -$quoteSetup->addAttribute('quote_item', 'weee_tax_applied_row_amount', ['type' => 'decimal']); -$quoteSetup->addAttribute('quote_item', 'weee_tax_disposition', ['type' => 'decimal']); -$quoteSetup->addAttribute('quote_item', 'weee_tax_row_disposition', ['type' => 'decimal']); -$quoteSetup->addAttribute('quote_item', 'base_weee_tax_applied_amount', ['type' => 'decimal']); -$quoteSetup->addAttribute('quote_item', 'base_weee_tax_applied_row_amnt', ['type' => 'decimal']); -$quoteSetup->addAttribute('quote_item', 'base_weee_tax_disposition', ['type' => 'decimal']); -$quoteSetup->addAttribute('quote_item', 'base_weee_tax_row_disposition', ['type' => 'decimal']); - -$salesSetup = $this->createSalesSetup(['resourceName' => 'sales_setup']); -$salesSetup->addAttribute('order_item', 'weee_tax_applied', ['type' => 'text']); -$salesSetup->addAttribute('order_item', 'weee_tax_applied_amount', ['type' => 'decimal']); -$salesSetup->addAttribute('order_item', 'weee_tax_applied_row_amount', ['type' => 'decimal']); -$salesSetup->addAttribute('order_item', 'weee_tax_disposition', ['type' => 'decimal']); -$salesSetup->addAttribute('order_item', 'weee_tax_row_disposition', ['type' => 'decimal']); -$salesSetup->addAttribute('order_item', 'base_weee_tax_applied_amount', ['type' => 'decimal']); -$salesSetup->addAttribute('order_item', 'base_weee_tax_applied_row_amnt', ['type' => 'decimal']); -$salesSetup->addAttribute('order_item', 'base_weee_tax_disposition', ['type' => 'decimal']); -$salesSetup->addAttribute('order_item', 'base_weee_tax_row_disposition', ['type' => 'decimal']); - -$salesSetup->addAttribute('invoice_item', 'weee_tax_applied', ['type' => 'text']); -$salesSetup->addAttribute('invoice_item', 'weee_tax_applied_amount', ['type' => 'decimal']); -$salesSetup->addAttribute('invoice_item', 'weee_tax_applied_row_amount', ['type' => 'decimal']); -$salesSetup->addAttribute('invoice_item', 'weee_tax_disposition', ['type' => 'decimal']); -$salesSetup->addAttribute('invoice_item', 'weee_tax_row_disposition', ['type' => 'decimal']); -$salesSetup->addAttribute('invoice_item', 'base_weee_tax_applied_amount', ['type' => 'decimal']); -$salesSetup->addAttribute('invoice_item', 'base_weee_tax_applied_row_amnt', ['type' => 'decimal']); -$salesSetup->addAttribute('invoice_item', 'base_weee_tax_disposition', ['type' => 'decimal']); -$salesSetup->addAttribute('invoice_item', 'base_weee_tax_row_disposition', ['type' => 'decimal']); - -$salesSetup->addAttribute('creditmemo_item', 'weee_tax_applied', ['type' => 'text']); -$salesSetup->addAttribute('creditmemo_item', 'weee_tax_applied_amount', ['type' => 'decimal']); -$salesSetup->addAttribute('creditmemo_item', 'weee_tax_applied_row_amount', ['type' => 'decimal']); -$salesSetup->addAttribute('creditmemo_item', 'weee_tax_disposition', ['type' => 'decimal']); -$salesSetup->addAttribute('creditmemo_item', 'weee_tax_row_disposition', ['type' => 'decimal']); -$salesSetup->addAttribute('creditmemo_item', 'base_weee_tax_applied_amount', ['type' => 'decimal']); -$salesSetup->addAttribute('creditmemo_item', 'base_weee_tax_applied_row_amnt', ['type' => 'decimal']); -$salesSetup->addAttribute('creditmemo_item', 'base_weee_tax_disposition', ['type' => 'decimal']); -$salesSetup->addAttribute('creditmemo_item', 'base_weee_tax_row_disposition', ['type' => 'decimal']); diff --git a/app/code/Magento/Weee/etc/di.xml b/app/code/Magento/Weee/etc/di.xml index 628e14cdfd8ce..92feb75d2877c 100644 --- a/app/code/Magento/Weee/etc/di.xml +++ b/app/code/Magento/Weee/etc/di.xml @@ -18,13 +18,6 @@ Magento\Weee\Helper\Data\Proxy - - - - Magento\Weee\Model\Resource\Setup - - - diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced.php index debe1b710f82b..84a57e124095f 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced.php @@ -10,9 +10,9 @@ $prices = [5, 10, 15, 20, 50, 100, 150]; -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_base.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_base.php index 4018094128e5f..9e87c2853f313 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_base.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_base.php @@ -10,9 +10,9 @@ $testCases = include __DIR__ . '/_algorithm_base_data.php'; -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/_files/attribute_weight_filterable.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/_files/attribute_weight_filterable.php index 6d5fda70fe26f..69a3aad7511d4 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/_files/attribute_weight_filterable.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/_files/attribute_weight_filterable.php @@ -4,9 +4,9 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/_files/attribute_with_option.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/_files/attribute_with_option.php index 7a81d13ec07b4..7c0f785441306 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/_files/attribute_with_option.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/_files/attribute_with_option.php @@ -5,9 +5,9 @@ */ /* Create attribute */ -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php index 0940e36e687bf..4c33963026787 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php @@ -3,8 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ +/** @var \Magento\Catalog\Setup\CategorySetup $installer */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/filterable_attributes.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/filterable_attributes.php index a1634cbf92ee6..35c02c73cdd32 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/filterable_attributes.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/filterable_attributes.php @@ -4,9 +4,9 @@ * See COPYING.txt for license details. */ -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); $attributeSetId = $installer->getAttributeSetId('catalog_product', 'Default'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute.php index c4fb76567b189..8a9dddc665d5a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute.php @@ -5,9 +5,9 @@ */ /* Create attribute */ -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/price_row_fixture.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/price_row_fixture.php index 7e7ade7e1e9b0..fc375e1a9badd 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/price_row_fixture.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/price_row_fixture.php @@ -4,8 +4,9 @@ * See COPYING.txt for license details. */ +/** @var \Magento\Catalog\Setup\CategorySetup $installer */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php index 6c9ce8ee2e7ef..e7c20296101f1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php @@ -4,9 +4,9 @@ * See COPYING.txt for license details. */ -/** @var \Magento\Catalog\Model\Resource\Setup $installer */ +/** @var \Magento\Catalog\Setup\CategorySetup $installer */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute.php index 4486972a569bd..6f7874f4e1751 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute.php @@ -5,9 +5,9 @@ */ require __DIR__ . '/multiselect_attribute.php'; -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/row_fixture.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/row_fixture.php index 79e6ea9eaf540..8d738655cd804 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/row_fixture.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/row_fixture.php @@ -4,8 +4,9 @@ * See COPYING.txt for license details. */ +/** @var \Magento\Catalog\Setup\CategorySetup $installer */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); /** diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/attribute.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/attribute.php index 0df5f8543bd6f..63160da95cf91 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/attribute.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/attribute.php @@ -4,9 +4,9 @@ * See COPYING.txt for license details. */ -/** @var \Magento\Catalog\Model\Resource\Setup $installer */ +/** @var \Magento\Catalog\Setup\CategorySetup $installer */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories.php index 0a9e8954f2e9d..89e34eecbed27 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories.php @@ -7,10 +7,6 @@ \Magento\TestFramework\Helper\Bootstrap::getInstance() ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); -$installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', - ['resourceName' => 'catalog_setup'] -); /** * After installation system has two categories: root one with ID:1 and Default category with ID:2 */ diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php index e221322ec827e..32f86ff2c21a7 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php @@ -4,8 +4,9 @@ * See COPYING.txt for license details. */ +/** @var \Magento\Catalog\Setup\CategorySetup $installer */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); require __DIR__ . '/categories.php'; diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products_rollback.php index 1627071d7b654..1a4f4c56244a1 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products_rollback.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products_rollback.php @@ -4,10 +4,6 @@ * See COPYING.txt for license details. */ -$installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', - ['resourceName' => 'catalog_setup'] -); $registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\Registry'); $registry->unregister('isSecureArea'); $registry->register('isSecureArea', true); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute.php index 009cd3536f585..1ae17867f9495 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute.php @@ -5,9 +5,9 @@ */ /* Create attribute */ -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable.php index bc8f487de822f..b083d7e52dfb2 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable.php @@ -6,9 +6,9 @@ require __DIR__ . '/configurable_attribute.php'; -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +/** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address.php b/dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address.php index 160812655610f..f2e6bc218996a 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address.php +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address.php @@ -22,10 +22,13 @@ ); $model->save(); -/** @var \Magento\Customer\Model\Resource\Setup $setupResource */ +/** @var \Magento\Customer\Setup\CustomerSetup $setupResource */ $setupResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Customer\Model\Resource\Setup', + 'Magento\Customer\Setup\CustomerSetup', ['resourceName' => 'customer_setup'] ); $data = [['form_code' => 'customer_address_edit', 'attribute_id' => $model->getAttributeId()]]; -$setupResource->getConnection()->insertMultiple($setupResource->getTable('customer_form_attribute'), $data); +$setupResource->getSetup()->getConnection()->insertMultiple( + $setupResource->getSetup()->getTable('customer_form_attribute'), + $data +); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address_custom_attribute.php b/dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address_custom_attribute.php index f294478125f97..bd7d175a7cb71 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address_custom_attribute.php +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address_custom_attribute.php @@ -40,14 +40,20 @@ ); $model2->save(); -/** @var \Magento\Customer\Model\Resource\Setup $setupResource */ +/** @var \Magento\Customer\Setup\CustomerSetup $setupResource */ $setupResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Customer\Model\Resource\Setup', + 'Magento\Customer\Setup\CustomerSetup', ['resourceName' => 'customer_setup'] ); $data = [['form_code' => 'customer_address_edit', 'attribute_id' => $model->getAttributeId()]]; -$setupResource->getConnection()->insertMultiple($setupResource->getTable('customer_form_attribute'), $data); +$setupResource->getSetup()->getConnection()->insertMultiple( + $setupResource->getSetup()->getTable('customer_form_attribute'), + $data +); $data2 = [['form_code' => 'customer_address_edit', 'attribute_id' => $model2->getAttributeId()]]; -$setupResource->getConnection()->insertMultiple($setupResource->getTable('customer_form_attribute'), $data2); +$setupResource->getSetup()->getConnection()->insertMultiple( + $setupResource->getSetup()->getTable('customer_form_attribute'), + $data2 +); diff --git a/dev/tests/integration/testsuite/Magento/Weee/_files/product_with_fpt.php b/dev/tests/integration/testsuite/Magento/Weee/_files/product_with_fpt.php index 8665600414afd..98fb6f8ca6af8 100644 --- a/dev/tests/integration/testsuite/Magento/Weee/_files/product_with_fpt.php +++ b/dev/tests/integration/testsuite/Magento/Weee/_files/product_with_fpt.php @@ -4,8 +4,9 @@ * See COPYING.txt for license details. */ +/** @var \Magento\Catalog\Setup\CategorySetup $installer */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); $attributeSetId = $installer->getAttributeSetId('catalog_product', 'Default'); diff --git a/dev/tests/performance/testsuite/fixtures/catalog_category.php b/dev/tests/performance/testsuite/fixtures/catalog_category.php index f2b636ce1d618..738558f423307 100644 --- a/dev/tests/performance/testsuite/fixtures/catalog_category.php +++ b/dev/tests/performance/testsuite/fixtures/catalog_category.php @@ -6,8 +6,9 @@ /** @var \Magento\TestFramework\Application $this */ +/** @var \Magento\Catalog\Setup\CategorySetup $installer */ $installer = $this->getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Catalog\Setup\CategorySetup', ['resourceName' => 'catalog_setup'] ); /** diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 6a4f0deb2e3e3..a08a7cdb9ca32 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -1630,7 +1630,8 @@ ['Magento\Core\Block\Text\TextList\Link', 'Magento\Framework\View\Element\Text\TextList\Link'], ['Magento\Core\Block\Messages', 'Magento\Framework\View\Element\Messages'], ['Magento\Core\Model\Message', 'Magento\Framework\Message\Factory'], - ['Magento\Core\Model\Resource\Setup', 'Magento\Theme\Model\Resource\Setup'], + ['Magento\Core\Model\Resource\Setup'], + ['Magento\Core\Model\Resource\Setup'], ['Magento\Core\Model\Message\AbstractMessage', 'Magento\Framework\Message\AbstractMessage'], ['Magento\Core\Model\Message\Collection', 'Magento\Framework\Message\Collection'], ['Magento\Core\Model\Message\CollectionFactory', 'Magento\Framework\Message\CollectionFactory'], diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 8ea980483d11f..30afb364d5c74 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -315,13 +315,11 @@ ['collectRoutes', 'Magento\Core\App\Router\Base'], ['composeLocaleHierarchy', 'Magento\Translation\Helper\Data'], ['convertOldTaxData', 'Magento\Tax\Model\Resource\Setup'], - ['convertOldTreeToNew', 'Magento\Catalog\Model\Resource\Setup'], ['copyFieldset', 'Magento\Core\Helper\Data', 'copyFieldsetToTarget'], ['copyQuoteFilesToOrderFiles', 'Magento\Catalog\Model\Product\Option\Observer'], ['countChildren', 'Magento\Core\Block\AbstractBlock'], ['crear'], ['createDirIfNotExists', '', 'mkdir()'], - ['createEntityTables', 'Magento\Eav\Model\Entity\Setup'], ['createOrderItem', 'Magento\CatalogInventory\Model\Observer'], ['debugRequest', 'Magento\Paypal\Model\Api\Standard'], ['decodeFilter', 'Magento\Backend\Helper\Data'], @@ -764,7 +762,6 @@ ['productEventAggregate'], ['publishRelatedViewFile', 'Magento\Framework\View\Publisher', '_publishRelatedViewFile'], ['push', 'Magento\Catalog\Model\Product\Image'], - ['rebuildCategoryLevels', 'Magento\Catalog\Model\Resource\Setup'], ['refundOrderItem', 'Magento\CatalogInventory\Model\Observer'], ['regenerateSessionId', 'Magento\Core\Model\Session\AbstractSession'], ['reinitialize', 'Magento\TestFramework\Bootstrap', 'Magento_TestFramework_Helper_Bootstrap::reinitialize'], @@ -992,7 +989,6 @@ ['setIsSerializable', 'Magento\Framework\App\State'], ['getIsSerializable', 'Magento\Framework\App\State'], ['_getInventoryItemResource', 'Magento\Reports\Model\Resource\Product\Lowstock\Collection'], - ['getMigrationInstance', 'Magento\Customer\Model\Resource\Setup', '$this->_migrationFactory->create()'], ['turnOnReadCommittedMode', 'Magento\Backup\Model\Resource\Db'], ['turnOnSerializableMode', 'Magento\Backup\Model\Resource\Db', 'prepareTransactionIsolationLevel'], ['turnOnMaintenanceMode', 'Magento\Backup\Helper\Data', 'Magento\Framework\App\MaintenanceMode::set'], @@ -1013,7 +1009,6 @@ ['getHttpUserRemoteAddr', '\Magento\Core\Helper\Http'], ['getHttpUserServerAddr', '\Magento\Core\Helper\Http'], ['getEncryptor', '\Magento\Core\Helper\Data', '\Magento\Framework\Encryption\Encryptor'], - ['getCoreData', '\Magento\Sales\Model\Resource\Setup'], ['encrypt', '\Magento\Core\Helper\Data'], ['decrypt', '\Magento\Core\Helper\Data'], ['validateKey', '\Magento\Core\Helper\Data', '\Magento\Framework\Encryption\EncryptorInterface'], @@ -2025,9 +2020,6 @@ ['getSkinImagePlaceholderUrl', 'Magento\Cms\Model\Wysiwyg\Config'], ['compareIndexColumnProperties', 'Magento\Catalog\Model\Resource\Helper'], ['getIsNullNotNullCondition', 'Magento\Catalog\Model\Resource\Helper'], - ['_getCategoryPath', 'Magento\Catalog\Model\Resource\Setup'], - ['_getCategoryEntityRow', 'Magento\Catalog\Model\Resource\Setup'], - ['createEavAttributeResource', 'Magento\Catalog\Model\Resource\Setup'], ['getAllNonNominalItems', 'Magento\Sales\Model\Quote\Address'], ['getAllNominalItems', 'Magento\Sales\Model\Quote\Address'], ['isNominal', 'Magento\Sales\Model\Order\Item'], diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/SetupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Setup/CategorySetupTest.php similarity index 93% rename from dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/SetupTest.php rename to dev/tests/unit/testsuite/Magento/Catalog/Setup/CategorySetupTest.php index 666e59edd35df..feadf031d4126 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/SetupTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Setup/CategorySetupTest.php @@ -3,17 +3,17 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Catalog\Model\Resource; +namespace Magento\Catalog\Setup; -class SetupTest extends \PHPUnit_Framework_TestCase +class CategorySetupTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Catalog\Model\Resource\Setup */ + /** @var \Magento\Catalog\Setup\CategorySetup */ protected $unit; protected function setUp() { $this->unit = (new \Magento\TestFramework\Helper\ObjectManager($this))->getObject( - 'Magento\Catalog\Model\Resource\Setup' + 'Magento\Catalog\Setup\CategorySetup' ); } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php index 11cf13857b10b..2bc27f87e1a2d 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php @@ -23,7 +23,7 @@ class UpdaterTest extends \PHPUnit_Framework_TestCase protected $_moduleListMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Setup\Module\DataSetup|\PHPUnit_Framework_MockObject_MockObject */ protected $_resourceSetupMock; @@ -49,7 +49,7 @@ protected function setUp() $this->_moduleListMock = $this->getMock('Magento\Framework\Module\ModuleListInterface'); $this->_resourceResolver = $this->getMock('Magento\Framework\Module\ResourceResolverInterface'); $this->_resourceSetupMock = $this->getMock( - 'Magento\Catalog\Model\Resource\Setup', + 'Magento\Setup\Module\DataSetup', [], [], '', diff --git a/dev/tests/unit/testsuite/Magento/Tax/Model/Resource/SetupTest.php b/dev/tests/unit/testsuite/Magento/Tax/Setup/TaxSetupTest.php similarity index 84% rename from dev/tests/unit/testsuite/Magento/Tax/Model/Resource/SetupTest.php rename to dev/tests/unit/testsuite/Magento/Tax/Setup/TaxSetupTest.php index 9d36d848b1379..63eae4eba1bc2 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Model/Resource/SetupTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Setup/TaxSetupTest.php @@ -3,12 +3,12 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Tax\Model\Resource; +namespace Magento\Tax\Setup; -class SetupTest extends \PHPUnit_Framework_TestCase +class TaxSetupTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Tax\Model\Resource\Setup + * @var \Magento\Tax\Setup\TaxSetup */ protected $taxSetup; @@ -22,7 +22,7 @@ protected function setUp() $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->typeConfigMock = $this->getMock('Magento\Catalog\Model\ProductTypes\ConfigInterface'); $this->taxSetup = $helper->getObject( - 'Magento\Tax\Model\Resource\Setup', + 'Magento\Tax\Setup\TaxSetup', ['productTypeConfig' => $this->typeConfigMock] ); } From ffabeecabcb55b9d2f51079a7dc6ae0798a95384 Mon Sep 17 00:00:00 2001 From: Maddy Chellathurai Date: Thu, 12 Feb 2015 13:44:05 -0600 Subject: [PATCH 030/106] MAGETWO-33889: Convert CE schema and data scripts to SPI classes - Adding for the first time InstallSchema, UpdateSchema and InstallData for respective classes --- .../AdminNotification/Setup/InstallSchema.php | 123 + .../Authorization/Setup/InstallSchema.php | 150 + .../Magento/Bundle/Setup/InstallSchema.php | 1025 ++++ .../Magento/Captcha/Setup/InstallSchema.php | 60 + .../Magento/Catalog/Setup/InstallSchema.php | 4553 +++++++++++++++ .../Magento/Catalog/Setup/UpgradeSchema.php | 53 + .../CatalogInventory/Setup/InstallSchema.php | 457 ++ .../Magento/CatalogRule/Setup/InstallData.php | 45 + .../CatalogRule/Setup/InstallSchema.php | 531 ++ .../CatalogSearch/Setup/InstallSchema.php | 88 + .../CatalogUrlRewrite/Setup/InstallSchema.php | 84 + .../Setup/InstallSchema.php | 116 + app/code/Magento/Cms/Setup/InstallSchema.php | 280 + .../Setup/InstallSchema.php | 316 + .../Setup/UpgradeSchema.php | 36 + ...tall-2.0.1.php => upgrade-2.0.0-2.0.1.php} | 0 app/code/Magento/Core/Setup/InstallData.php | 52 + app/code/Magento/Core/Setup/InstallSchema.php | 492 ++ app/code/Magento/Cron/Setup/InstallSchema.php | 93 + .../Magento/Customer/Setup/InstallData.php | 2 + .../Magento/Customer/Setup/InstallSchema.php | 1199 ++++ .../Magento/Customer/Setup/UpgradeSchema.php | 62 + .../DesignEditor/Setup/InstallSchema.php | 66 + .../Magento/Directory/Setup/InstallSchema.php | 205 + .../Downloadable/Setup/InstallSchema.php | 727 +++ app/code/Magento/Eav/Setup/InstallSchema.php | 1451 +++++ .../Magento/Email/Setup/InstallSchema.php | 122 + app/code/Magento/Fedex/Setup/InstallData.php | 107 + .../GiftMessage/Setup/InstallSchema.php | 69 + .../GoogleOptimizer/Setup/InstallSchema.php | 89 + .../GoogleShopping/Setup/InstallData.php | 2 + .../GoogleShopping/Setup/InstallSchema.php | 196 + .../ImportExport/Setup/InstallSchema.php | 64 + .../Magento/Indexer/Setup/InstallSchema.php | 132 + .../Integration/Setup/InstallSchema.php | 371 ++ app/code/Magento/Log/Setup/InstallData.php | 34 + app/code/Magento/Log/Setup/InstallSchema.php | 404 ++ .../Newsletter/Setup/InstallSchema.php | 472 ++ .../OfflineShipping/Setup/InstallSchema.php | 142 + .../Persistent/Setup/InstallSchema.php | 113 + .../ProductAlert/Setup/InstallSchema.php | 210 + .../Magento/Quote/Setup/InstallSchema.php | 1551 +++++ .../Magento/Reports/Setup/InstallSchema.php | 872 +++ app/code/Magento/Review/Setup/InstallData.php | 76 + .../Magento/Review/Setup/InstallSchema.php | 767 +++ .../Magento/Sales/Setup/InstallSchema.php | 5174 +++++++++++++++++ .../Magento/Sales/Setup/UpgradeSchema.php | 62 + .../Magento/SalesRule/Setup/InstallData.php | 45 + .../Magento/SalesRule/Setup/InstallSchema.php | 798 +++ .../Magento/Search/Setup/InstallSchema.php | 134 + .../Sendfriend/Setup/InstallSchema.php | 66 + .../Magento/Sitemap/Setup/InstallSchema.php | 86 + .../Magento/Store/Setup/InstallSchema.php | 294 + app/code/Magento/Tax/Setup/InstallSchema.php | 517 ++ .../Magento/Theme/Setup/InstallSchema.php | 161 + .../Magento/Theme/Setup/UpgradeSchema.php | 39 + .../Translation/Setup/InstallSchema.php | 106 + .../UrlRewrite/Setup/InstallSchema.php | 124 + app/code/Magento/User/Setup/InstallSchema.php | 144 + app/code/Magento/Usps/Setup/InstallData.php | 101 + app/code/Magento/Weee/Setup/InstallSchema.php | 124 + app/code/Magento/Weee/Setup/UpgradeSchema.php | 32 + app/code/Magento/Widget/Setup/InstallData.php | 37 + .../Magento/Widget/Setup/InstallSchema.php | 293 + .../Magento/Wishlist/Setup/InstallSchema.php | 212 + 65 files changed, 26608 insertions(+) create mode 100644 app/code/Magento/AdminNotification/Setup/InstallSchema.php create mode 100644 app/code/Magento/Authorization/Setup/InstallSchema.php create mode 100644 app/code/Magento/Bundle/Setup/InstallSchema.php create mode 100644 app/code/Magento/Captcha/Setup/InstallSchema.php create mode 100644 app/code/Magento/Catalog/Setup/InstallSchema.php create mode 100644 app/code/Magento/Catalog/Setup/UpgradeSchema.php create mode 100644 app/code/Magento/CatalogInventory/Setup/InstallSchema.php create mode 100755 app/code/Magento/CatalogRule/Setup/InstallData.php create mode 100644 app/code/Magento/CatalogRule/Setup/InstallSchema.php create mode 100644 app/code/Magento/CatalogSearch/Setup/InstallSchema.php create mode 100644 app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php create mode 100644 app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php create mode 100644 app/code/Magento/Cms/Setup/InstallSchema.php create mode 100644 app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php create mode 100644 app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php rename app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/{install-2.0.1.php => upgrade-2.0.0-2.0.1.php} (100%) create mode 100755 app/code/Magento/Core/Setup/InstallData.php create mode 100644 app/code/Magento/Core/Setup/InstallSchema.php create mode 100644 app/code/Magento/Cron/Setup/InstallSchema.php create mode 100644 app/code/Magento/Customer/Setup/InstallSchema.php create mode 100644 app/code/Magento/Customer/Setup/UpgradeSchema.php create mode 100644 app/code/Magento/DesignEditor/Setup/InstallSchema.php create mode 100644 app/code/Magento/Directory/Setup/InstallSchema.php create mode 100644 app/code/Magento/Downloadable/Setup/InstallSchema.php create mode 100644 app/code/Magento/Eav/Setup/InstallSchema.php create mode 100644 app/code/Magento/Email/Setup/InstallSchema.php create mode 100755 app/code/Magento/Fedex/Setup/InstallData.php create mode 100644 app/code/Magento/GiftMessage/Setup/InstallSchema.php create mode 100644 app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php create mode 100644 app/code/Magento/GoogleShopping/Setup/InstallSchema.php create mode 100644 app/code/Magento/ImportExport/Setup/InstallSchema.php create mode 100644 app/code/Magento/Indexer/Setup/InstallSchema.php create mode 100644 app/code/Magento/Integration/Setup/InstallSchema.php create mode 100755 app/code/Magento/Log/Setup/InstallData.php create mode 100644 app/code/Magento/Log/Setup/InstallSchema.php create mode 100644 app/code/Magento/Newsletter/Setup/InstallSchema.php create mode 100644 app/code/Magento/OfflineShipping/Setup/InstallSchema.php create mode 100644 app/code/Magento/Persistent/Setup/InstallSchema.php create mode 100644 app/code/Magento/ProductAlert/Setup/InstallSchema.php create mode 100644 app/code/Magento/Quote/Setup/InstallSchema.php create mode 100644 app/code/Magento/Reports/Setup/InstallSchema.php create mode 100755 app/code/Magento/Review/Setup/InstallData.php create mode 100644 app/code/Magento/Review/Setup/InstallSchema.php create mode 100644 app/code/Magento/Sales/Setup/InstallSchema.php create mode 100644 app/code/Magento/Sales/Setup/UpgradeSchema.php create mode 100755 app/code/Magento/SalesRule/Setup/InstallData.php create mode 100644 app/code/Magento/SalesRule/Setup/InstallSchema.php create mode 100644 app/code/Magento/Search/Setup/InstallSchema.php create mode 100644 app/code/Magento/Sendfriend/Setup/InstallSchema.php create mode 100644 app/code/Magento/Sitemap/Setup/InstallSchema.php create mode 100644 app/code/Magento/Store/Setup/InstallSchema.php create mode 100644 app/code/Magento/Tax/Setup/InstallSchema.php create mode 100644 app/code/Magento/Theme/Setup/InstallSchema.php create mode 100644 app/code/Magento/Theme/Setup/UpgradeSchema.php create mode 100644 app/code/Magento/Translation/Setup/InstallSchema.php create mode 100644 app/code/Magento/UrlRewrite/Setup/InstallSchema.php create mode 100644 app/code/Magento/User/Setup/InstallSchema.php create mode 100755 app/code/Magento/Usps/Setup/InstallData.php create mode 100644 app/code/Magento/Weee/Setup/InstallSchema.php create mode 100644 app/code/Magento/Weee/Setup/UpgradeSchema.php create mode 100755 app/code/Magento/Widget/Setup/InstallData.php create mode 100644 app/code/Magento/Widget/Setup/InstallSchema.php create mode 100644 app/code/Magento/Wishlist/Setup/InstallSchema.php diff --git a/app/code/Magento/AdminNotification/Setup/InstallSchema.php b/app/code/Magento/AdminNotification/Setup/InstallSchema.php new file mode 100644 index 0000000000000..223635baaefb2 --- /dev/null +++ b/app/code/Magento/AdminNotification/Setup/InstallSchema.php @@ -0,0 +1,123 @@ +startSetup(); + /** + * Create table 'adminnotification_inbox' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('adminnotification_inbox') + )->addColumn( + 'notification_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Notification id' + )->addColumn( + 'severity', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Problem type' + )->addColumn( + 'date_added', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Create date' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Title' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Url' + )->addColumn( + 'is_read', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Flag if notification read' + )->addColumn( + 'is_remove', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Flag if notification might be removed' + )->addIndex( + $installer->getIdxName('adminnotification_inbox', ['severity']), + ['severity'] + )->addIndex( + $installer->getIdxName('adminnotification_inbox', ['is_read']), + ['is_read'] + )->addIndex( + $installer->getIdxName('adminnotification_inbox', ['is_remove']), + ['is_remove'] + )->setComment( + 'Adminnotification Inbox' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'admin_system_messages' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('admin_system_messages') + )->addColumn( + 'identity', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['nullable' => false, 'primary' => true], + 'Message id' + )->addColumn( + 'severity', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Problem type' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Create date' + )->setComment( + 'Admin System Messages' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Authorization/Setup/InstallSchema.php b/app/code/Magento/Authorization/Setup/InstallSchema.php new file mode 100644 index 0000000000000..65333a2216742 --- /dev/null +++ b/app/code/Magento/Authorization/Setup/InstallSchema.php @@ -0,0 +1,150 @@ +startSetup(); + + if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_role'))) { + /** + * Create table 'authorization_role' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('authorization_role') + )->addColumn( + 'role_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Role ID' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Parent Role ID' + )->addColumn( + 'tree_level', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Role Tree Level' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Role Sort Order' + )->addColumn( + 'role_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 1, + ['nullable' => false, 'default' => '0'], + 'Role Type' + )->addColumn( + 'user_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'User ID' + )->addColumn( + 'user_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['nullable' => true, 'default' => null], + 'User Type' + )->addColumn( + 'role_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => true, 'default' => null], + 'Role Name' + )->addIndex( + $installer->getIdxName('authorization_role', ['parent_id', 'sort_order']), + ['parent_id', 'sort_order'] + )->addIndex( + $installer->getIdxName('authorization_role', ['tree_level']), + ['tree_level'] + )->setComment( + 'Admin Role Table' + ); + $installer->getConnection()->createTable($table); + } + + if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_rule'))) { + /** + * Create table 'authorization_rule' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('authorization_rule') + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule ID' + )->addColumn( + 'role_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Role ID' + )->addColumn( + 'resource_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Resource ID' + )->addColumn( + 'privileges', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + ['nullable' => true], + 'Privileges' + )->addColumn( + 'permission', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 10, + [], + 'Permission' + )->addIndex( + $installer->getIdxName('authorization_rule', ['resource_id', 'role_id']), + ['resource_id', 'role_id'] + )->addIndex( + $installer->getIdxName('authorization_rule', ['role_id', 'resource_id']), + ['role_id', 'resource_id'] + )->addForeignKey( + $installer->getFkName('authorization_rule', 'role_id', 'authorization_role', 'role_id'), + 'role_id', + $installer->getTable('authorization_role'), + 'role_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Admin Rule Table' + ); + $installer->getConnection()->createTable($table); + } + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php new file mode 100644 index 0000000000000..ab16cc99fa89d --- /dev/null +++ b/app/code/Magento/Bundle/Setup/InstallSchema.php @@ -0,0 +1,1025 @@ +startSetup(); + + /** + * Create table 'catalog_product_bundle_option' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_bundle_option')) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Id' + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + ) + ->addColumn( + 'required', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Required' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Type' + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_option', ['parent_id']), + ['parent_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_bundle_option', 'parent_id', 'catalog_product_entity', 'entity_id'), + 'parent_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Bundle Option'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_bundle_option_value' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_bundle_option_value')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Option Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_bundle_option_value', + ['option_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_bundle_option_value', + 'option_id', + 'catalog_product_bundle_option', + 'option_id' + ), + 'option_id', + $installer->getTable('catalog_product_bundle_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Bundle Option Value'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_bundle_selection' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_bundle_selection')) + ->addColumn( + 'selection_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Selection Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Option Id' + ) + ->addColumn( + 'parent_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Product Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Product Id' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'is_default', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Default' + ) + ->addColumn( + 'selection_price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Selection Price Type' + ) + ->addColumn( + 'selection_price_value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Selection Price Value' + ) + ->addColumn( + 'selection_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Selection Qty' + ) + ->addColumn( + 'selection_can_change_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Selection Can Change Qty' + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_selection', ['option_id']), + ['option_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_selection', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_bundle_selection', + 'option_id', + 'catalog_product_bundle_option', + 'option_id' + ), + 'option_id', + $installer->getTable('catalog_product_bundle_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_bundle_selection', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Bundle Selection'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_bundle_selection_price' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_bundle_selection_price')) + ->addColumn( + 'selection_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Selection Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'selection_price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Selection Price Type' + ) + ->addColumn( + 'selection_price_value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Selection Price Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_selection_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_bundle_selection_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_bundle_selection_price', + 'selection_id', + 'catalog_product_bundle_selection', + 'selection_id' + ), + 'selection_id', + $installer->getTable('catalog_product_bundle_selection'), + 'selection_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Bundle Selection Price'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_bundle_price_index' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_bundle_price_index')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Max Price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_price_index', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_price_index', ['customer_group_id']), + ['customer_group_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_bundle_price_index', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_bundle_price_index', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_bundle_price_index', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Bundle Price Index'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_bundle_stock_index' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_bundle_stock_index') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Stock Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option Id' + ) + ->addColumn( + 'stock_status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['default' => '0'], + 'Stock Status' + ) + ->setComment('Catalog Product Bundle Stock Index'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_idx' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_idx')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class Id' + ) + ->addColumn( + 'price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Price Type' + ) + ->addColumn( + 'special_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Special Price' + ) + ->addColumn( + 'tier_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Percent' + ) + ->addColumn( + 'orig_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Orig Price' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'base_tier', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tier' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'base_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Group Price' + ) + ->addColumn( + 'group_price_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group Price Percent' + ) + ->setComment('Catalog Product Index Price Bundle Idx'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_tmp' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_tmp')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class Id' + ) + ->addColumn( + 'price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Price Type' + ) + ->addColumn( + 'special_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Special Price' + ) + ->addColumn( + 'tier_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Percent' + ) + ->addColumn( + 'orig_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Orig Price' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'base_tier', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tier' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'base_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Group Price' + ) + ->addColumn( + 'group_price_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group Price Percent' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment('Catalog Product Index Price Bundle Tmp'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_sel_idx' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_sel_idx')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option Id' + ) + ->addColumn( + 'selection_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Selection Id' + ) + ->addColumn( + 'group_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Group Type' + ) + ->addColumn( + 'is_required', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Is Required' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment('Catalog Product Index Price Bundle Sel Idx'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_sel_tmp' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_sel_tmp')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option Id' + ) + ->addColumn( + 'selection_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Selection Id' + ) + ->addColumn( + 'group_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Group Type' + ) + ->addColumn( + 'is_required', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Is Required' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment('Catalog Product Index Price Bundle Sel Tmp'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_opt_idx' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_opt_idx')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option Id' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'alt_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'alt_tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'alt_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Group Price' + ) + ->setComment('Catalog Product Index Price Bundle Opt Idx'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_opt_tmp' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_opt_tmp')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option Id' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'alt_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'alt_tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'alt_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Group Price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment('Catalog Product Index Price Bundle Opt Tmp'); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Captcha/Setup/InstallSchema.php b/app/code/Magento/Captcha/Setup/InstallSchema.php new file mode 100644 index 0000000000000..b42146c02ef14 --- /dev/null +++ b/app/code/Magento/Captcha/Setup/InstallSchema.php @@ -0,0 +1,60 @@ +startSetup(); + + $table = $installer->getConnection()->newTable( + $installer->getTable('captcha_log') + )->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Type' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'unsigned' => true, 'primary' => true], + 'Value' + )->addColumn( + 'count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Count' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Update Time' + )->setComment( + 'Count Login Attempts' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php new file mode 100644 index 0000000000000..9e7442e3ca143 --- /dev/null +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -0,0 +1,4553 @@ +startSetup(); + + /** + * Create table 'catalog_product_entity' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'default' => 'simple'], + 'Type ID' + ) + ->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + [], + 'SKU' + ) + ->addColumn( + 'has_options', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Has Options' + ) + ->addColumn( + 'required_options', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Required Options' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Creation Time' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + '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'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity', ['sku']), + ['sku'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), + 'attribute_set_id', + $installer->getTable('eav_attribute_set'), + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_datetime' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_datetime')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_datetime', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_datetime', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_datetime', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Datetime Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_decimal' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_decimal')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_decimal', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_decimal', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_decimal', ['attribute_id']), + ['attribute_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Decimal Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_int' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_int')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_int', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_int', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_int', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Integer Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_text' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_text')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_text', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_text', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_text', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_text', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_text', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Text Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_varchar' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_varchar')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_varchar', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_varchar', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_varchar', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Varchar Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_gallery' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_gallery')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_gallery', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Gallery Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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'], + 'Attriute Set ID' + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Parent Category ID' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Creation Time' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Update Time' + ) + ->addColumn( + 'path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Tree Path' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Position' + ) + ->addColumn( + 'level', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Tree Level' + ) + ->addColumn( + 'children_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Child Count' + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity', ['level']), + ['level'] + ) + ->setComment('Catalog Category Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity_datetime' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_datetime')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_datetime', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Datetime Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity_decimal' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_decimal')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_decimal', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Decimal Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity_int' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_int')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_int', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_int', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_int', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_int', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Integer Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity_text' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_text')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_text', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_text', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_text', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_text', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Text Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity_varchar' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_varchar')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_varchar', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Varchar Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_product' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_product')) + ->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( + $installer->getIdxName('catalog_category_product', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_product', 'category_id', 'catalog_category_entity', 'entity_id'), + 'category_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_product', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product To Category Linkage Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_product_index' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_product_index')) + ->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, + ['unsigned' => false, 'nullable' => true, 'default' => null], + 'Position' + ) + ->addColumn( + 'is_parent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Parent' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'visibility', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Visibility' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_product_index', + ['product_id', 'store_id', 'category_id', 'visibility'] + ), + ['product_id', 'store_id', 'category_id', 'visibility'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_product_index', + ['store_id', 'category_id', 'visibility', 'is_parent', 'position'] + ), + ['store_id', 'category_id', 'visibility', 'is_parent', 'position'] + ) + ->setComment('Catalog Category Product Index'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_compare_item' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_compare_item') + ) + ->addColumn( + 'catalog_compare_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Compare Item ID' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Visitor ID' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store ID' + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['product_id']), + ['product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['visitor_id', 'product_id']), + ['visitor_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['customer_id', 'product_id']), + ['customer_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_compare_item', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_compare_item', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_compare_item', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Compare Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_website' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_website') + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName('catalog_product_website', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_website', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product To Website Linkage Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link_type' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_type') + ) + ->addColumn( + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link Type ID' + ) + ->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Code' + ) + ->setComment( + 'Catalog Product Link Type Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link') + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'linked_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Linked Product ID' + ) + ->addColumn( + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link Type ID' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link', + ['link_type_id', 'product_id', 'linked_product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['link_type_id', 'product_id', 'linked_product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_link', ['product_id']), + ['product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_link', ['linked_product_id']), + ['linked_product_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link', 'linked_product_id', 'catalog_product_entity', 'entity_id'), + 'linked_product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link', 'link_type_id', 'catalog_product_link_type', 'link_type_id'), + 'link_type_id', + $installer->getTable('catalog_product_link_type'), + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product To Product Linkage Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link_attribute' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute') + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link Type ID' + ) + ->addColumn( + 'product_link_attribute_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Product Link Attribute Code' + ) + ->addColumn( + 'data_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Data Type' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute', ['link_type_id']), + ['link_type_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute', + 'link_type_id', + 'catalog_product_link_type', + 'link_type_id' + ), + 'link_type_id', + $installer->getTable('catalog_product_link_type'), + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Attribute Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link_attribute_decimal' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute_decimal') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Link ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute_decimal', ['link_id']), + ['link_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_decimal', + ['product_link_attribute_id', 'link_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_link_attribute_id', 'link_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_decimal', 'link_id', 'catalog_product_link', 'link_id'), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_decimal', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Decimal Attribute Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link_attribute_int' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute_int') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Link ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute_int', ['link_id']), + ['link_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_int', + ['product_link_attribute_id', 'link_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_link_attribute_id', 'link_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_int', 'link_id', 'catalog_product_link', 'link_id'), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_int', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Integer Attribute Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link_attribute_varchar' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute_varchar') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Link ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute_varchar', ['link_id']), + ['link_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_varchar', + ['product_link_attribute_id', 'link_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_link_attribute_id', 'link_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_varchar', 'link_id', 'catalog_product_link', 'link_id'), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_varchar', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Varchar Attribute Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_entity_tier_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_tier_price') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'all_groups', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Applicable To All Customer Groups' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Group ID' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '1.0000'], + 'QTY' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_tier_price', + ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_tier_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_tier_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_tier_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_tier_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Tier Price Attribute Backend Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_entity_media_gallery' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_media_gallery') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery', ['entity_id']), + ['entity_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_media_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_media_gallery', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Media Gallery Attribute Backend Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_entity_media_gallery_value' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_media_gallery_value') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Value ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Label' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Position' + ) + ->addColumn( + 'disabled', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Disabled' + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery_value', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery_value', ['entity_id']), + ['entity_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_media_gallery_value', + 'value_id', + 'catalog_product_entity_media_gallery', + 'value_id' + ), + 'value_id', + $installer->getTable('catalog_product_entity_media_gallery'), + 'value_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_media_gallery_value', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_media_gallery_value', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Media Gallery Attribute Value Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option') + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => true, 'default' => null], + 'Type' + ) + ->addColumn( + 'is_require', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Is Required' + ) + ->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + [], + 'SKU' + ) + ->addColumn( + 'max_characters', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Max Characters' + ) + ->addColumn( + 'file_extension', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'File Extension' + ) + ->addColumn( + 'image_size_x', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Image Size X' + ) + ->addColumn( + 'image_size_y', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Image Size Y' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addIndex( + $installer->getIdxName('catalog_product_option', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_price') + ) + ->addColumn( + 'option_price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Price ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + ) + ->addColumn( + 'price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 7, + ['nullable' => false, 'default' => 'fixed'], + 'Price Type' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_price', + ['option_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_price', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_price', 'option_id', 'catalog_product_option', 'option_id'), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_price', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Price Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option_title' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_title') + ) + ->addColumn( + 'option_title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Title ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_title', + ['option_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_title', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_title', 'option_id', 'catalog_product_option', 'option_id'), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Title Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option_type_value' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_type_value') + ) + ->addColumn( + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Type ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + [], + 'SKU' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_type_value', ['option_id']), + ['option_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_type_value', 'option_id', 'catalog_product_option', 'option_id'), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Type Value Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option_type_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_type_price') + ) + ->addColumn( + 'option_type_price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Type Price ID' + ) + ->addColumn( + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option Type ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + ) + ->addColumn( + 'price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 7, + ['nullable' => false, 'default' => 'fixed'], + 'Price Type' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_type_price', + ['option_type_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_type_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_type_price', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_option_type_price', + 'option_type_id', + 'catalog_product_option_type_value', + 'option_type_id' + ), + 'option_type_id', + $installer->getTable('catalog_product_option_type_value'), + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_type_price', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Type Price Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option_type_title' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_type_title') + ) + ->addColumn( + 'option_type_title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Type Title ID' + ) + ->addColumn( + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option Type ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_type_title', + ['option_type_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_type_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_type_title', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_option_type_title', + 'option_type_id', + 'catalog_product_option_type_value', + 'option_type_id' + ), + 'option_type_id', + $installer->getTable('catalog_product_option_type_value'), + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_type_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Type Title Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_eav_attribute' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_eav_attribute') + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'frontend_input_renderer', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Frontend Input Renderer' + ) + ->addColumn( + 'is_global', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Global' + ) + ->addColumn( + 'is_visible', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Visible' + ) + ->addColumn( + 'is_searchable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Searchable' + ) + ->addColumn( + 'is_filterable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Filterable' + ) + ->addColumn( + 'is_comparable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Comparable' + ) + ->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + ) + ->addColumn( + 'is_html_allowed_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is HTML Allowed On Front' + ) + ->addColumn( + 'is_used_for_price_rules', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used For Price Rules' + ) + ->addColumn( + 'is_filterable_in_search', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Filterable In Search' + ) + ->addColumn( + 'used_in_product_listing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used In Product Listing' + ) + ->addColumn( + 'used_for_sort_by', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used For Sorting' + ) + ->addColumn( + 'apply_to', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Apply To' + ) + ->addColumn( + 'is_visible_in_advanced_search', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible In Advanced Search' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'is_wysiwyg_enabled', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is WYSIWYG Enabled' + ) + ->addColumn( + 'is_used_for_promo_rules', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used For Promo Rules' + ) + ->addColumn( + 'is_required_in_admin_store', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Required In Admin Store' + ) + ->addIndex( + $installer->getIdxName('catalog_eav_attribute', ['used_for_sort_by']), + ['used_for_sort_by'] + ) + ->addIndex( + $installer->getIdxName('catalog_eav_attribute', ['used_in_product_listing']), + ['used_in_product_listing'] + ) + ->addForeignKey( + $installer->getFkName('catalog_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog EAV Attribute Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_relation' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_relation') + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Parent ID' + ) + ->addColumn( + 'child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Child ID' + ) + ->addIndex( + $installer->getIdxName('catalog_product_relation', ['child_id']), + ['child_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_relation', 'child_id', 'catalog_product_entity', 'entity_id'), + 'child_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_relation', 'parent_id', 'catalog_product_entity', 'entity_id'), + 'parent_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Relation Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav_decimal' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_decimal') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'primary' => false], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Decimal Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'final_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Final Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price', ['min_price']), + ['min_price'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price', ['website_id', 'customer_group_id', 'min_price']), + ['website_id', 'customer_group_id', 'min_price'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_index_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Price Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_tier_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_tier_price') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_tier_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_tier_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_index_tier_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_tier_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Tier Price Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_website' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_website') + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'website_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Website Date' + ) + ->addColumn( + 'rate', + \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, + null, + ['default' => '1.0000'], + 'Rate' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_website', ['website_date']), + ['website_date'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Website Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_cfg_opt_agr_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_agr_idx') + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Parent ID' + ) + ->addColumn( + 'child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Child ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Aggregate Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_cfg_opt_agr_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_agr_tmp') + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Parent ID' + ) + ->addColumn( + 'child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Child ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Aggregate Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_cfg_opt_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_cfg_opt_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_final_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_final_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'orig_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Original Price' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'base_tier', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tier' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'base_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Group Price' + ) + ->setComment( + 'Catalog Product Price Indexer Final Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_final_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_final_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'orig_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Original Price' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'base_tier', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tier' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'base_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Group Price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Final Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_opt_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Option Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_opt_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Option Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_opt_agr_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_agr_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Option Aggregate Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_opt_agr_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_agr_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Option Aggregate Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Indexer Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', ['value']), + ['value'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product EAV Indexer Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav_decimal_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_decimal_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Decimal Indexer Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav_decimal_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_decimal_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'primary' => false], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['value']), + ['value'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product EAV Decimal Indexer Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'final_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Final Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', ['min_price']), + ['min_price'] + ) + ->setComment( + 'Catalog Product Price Indexer Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'final_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Final Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', ['min_price']), + ['min_price'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_category_product_index_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_category_product_index_tmp') + ) + ->addColumn( + 'category_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Category ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'is_parent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Parent' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'visibility', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Visibility' + ) + ->addIndex( + $installer->getIdxName('catalog_category_product_index_tmp', ['product_id', 'category_id', 'store_id']), + ['product_id', 'category_id', 'store_id'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Category Product Indexer Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_entity_group_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_group_price') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'all_groups', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Applicable To All Customer Groups' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Group ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_group_price', + ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_group_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_group_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_group_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_group_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_group_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Group Price Attribute Backend Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_group_price' + */ + + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_group_price') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_group_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_group_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_index_group_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_group_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_group_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Group Price Index Table' + ); + $installer->getConnection() + ->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..e51913faed7a0 --- /dev/null +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -0,0 +1,53 @@ +getVersion(), '2.0.0.1') <= 0) { + $installer = $setup; + + $installer->startSetup(); + + $connection = $installer->getConnection(); + $connection->dropForeignKey( + $installer->getTable('catalog_product_entity'), + 'FK_CAT_PRD_ENTT_ENTT_TYPE_ID_EAV_ENTT_TYPE_ENTT_TYPE_ID' + ); + + //Drop entity_type_id column for catalog product entities + $connection->dropColumn($installer->getTable('catalog_product_entity'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_product_entity_datetime'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_product_entity_decimal'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_product_entity_gallery'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_product_entity_int'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_product_entity_text'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_product_entity_varchar'), 'entity_type_id'); + + //Drop entity_type_id column for catalog category entities + $connection->dropColumn($installer->getTable('catalog_category_entity'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_category_entity_datetime'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_category_entity_decimal'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_category_entity_int'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_category_entity_text'), 'entity_type_id'); + $connection->dropColumn($installer->getTable('catalog_category_entity_varchar'), 'entity_type_id'); + + $installer->endSetup(); + } + } +} \ No newline at end of file diff --git a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php new file mode 100644 index 0000000000000..caeee4623a1de --- /dev/null +++ b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php @@ -0,0 +1,457 @@ +startSetup(); + + /** + * Create table 'cataloginventory_stock' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('cataloginventory_stock')) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Stock Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 5, + ['unsigned' => true, 'nullable' => false], + 'Website Id' + ) + ->addColumn( + 'stock_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Stock Name' + ) + ->addIndex( + $setup->getIdxName( + $installer->getTable('cataloginventory_stock'), + ['website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX + ), + ['website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX + ) + ->setComment('Cataloginventory Stock'); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'cataloginventory_stock_item' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('cataloginventory_stock_item')) + ->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Item Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Id' + ) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Stock Id' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['unsigned' => false, 'nullable' => true, 'default' => null], + 'Qty' + ) + ->addColumn( + 'min_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Min Qty' + ) + ->addColumn( + 'use_config_min_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Min Qty' + ) + ->addColumn( + 'is_qty_decimal', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Qty Decimal' + ) + ->addColumn( + 'backorders', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Backorders' + ) + ->addColumn( + 'use_config_backorders', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Backorders' + ) + ->addColumn( + 'min_sale_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '1.0000'], + 'Min Sale Qty' + ) + ->addColumn( + 'use_config_min_sale_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Min Sale Qty' + ) + ->addColumn( + 'max_sale_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Max Sale Qty' + ) + ->addColumn( + 'use_config_max_sale_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Max Sale Qty' + ) + ->addColumn( + 'is_in_stock', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is In Stock' + ) + ->addColumn( + 'low_stock_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Low Stock Date' + ) + ->addColumn( + 'notify_stock_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Notify Stock Qty' + ) + ->addColumn( + 'use_config_notify_stock_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Notify Stock Qty' + ) + ->addColumn( + 'manage_stock', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Manage Stock' + ) + ->addColumn( + 'use_config_manage_stock', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Manage Stock' + ) + ->addColumn( + 'stock_status_changed_auto', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Stock Status Changed Automatically' + ) + ->addColumn( + 'use_config_qty_increments', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Qty Increments' + ) + ->addColumn( + 'qty_increments', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty Increments' + ) + ->addColumn( + 'use_config_enable_qty_inc', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Enable Qty Increments' + ) + ->addColumn( + 'enable_qty_increments', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Enable Qty Increments' + ) + ->addColumn( + 'is_decimal_divided', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 5, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Divided into Multiple Boxes for Shipping' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 5, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Is Divided into Multiple Boxes for Shipping' + ) + ->addIndex( + $installer->getIdxName( + 'cataloginventory_stock_item', + ['product_id', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_id', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName( + 'cataloginventory_stock_item', + ['website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX + ), + ['website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX] + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_item', ['stock_id']), + ['stock_id'] + ) + ->addForeignKey( + $installer->getFkName('cataloginventory_stock_item', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('cataloginventory_stock_item', 'stock_id', 'cataloginventory_stock', 'stock_id'), + 'stock_id', + $installer->getTable('cataloginventory_stock'), + 'stock_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Cataloginventory Stock Item'); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'cataloginventory_stock_status' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('cataloginventory_stock_status')) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Stock Id' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty' + ) + ->addColumn( + 'stock_status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Stock Status' + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status', ['stock_id']), + ['stock_id'] + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status', ['website_id']), + ['website_id'] + ) + ->setComment('Cataloginventory Stock Status'); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'cataloginventory_stock_status_idx' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('cataloginventory_stock_status_idx')) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Stock Id' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty' + ) + ->addColumn( + 'stock_status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Stock Status' + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status_idx', ['stock_id']), + ['stock_id'] + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status_idx', ['website_id']), + ['website_id'] + ) + ->setComment('Cataloginventory Stock Status Indexer Idx'); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'cataloginventory_stock_status_tmp' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('cataloginventory_stock_status_tmp')) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Stock Id' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty' + ) + ->addColumn( + 'stock_status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Stock Status' + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status_tmp', ['stock_id']), + ['stock_id'] + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status_tmp', ['website_id']), + ['website_id'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment('Cataloginventory Stock Status Indexer Tmp'); + $installer->getConnection() + ->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/CatalogRule/Setup/InstallData.php b/app/code/Magento/CatalogRule/Setup/InstallData.php new file mode 100755 index 0000000000000..112852227906a --- /dev/null +++ b/app/code/Magento/CatalogRule/Setup/InstallData.php @@ -0,0 +1,45 @@ +createMigrationSetup(); + $installer->startSetup(); + + $installer->appendClassAliasReplace( + 'catalogrule', + 'conditions_serialized', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + ['rule_id'] + ); + $installer->appendClassAliasReplace( + 'catalogrule', + 'actions_serialized', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + ['rule_id'] + ); + + $installer->doUpdateClassAliases(); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/CatalogRule/Setup/InstallSchema.php b/app/code/Magento/CatalogRule/Setup/InstallSchema.php new file mode 100644 index 0000000000000..4d5c22745696a --- /dev/null +++ b/app/code/Magento/CatalogRule/Setup/InstallSchema.php @@ -0,0 +1,531 @@ +startSetup(); + + /** + * Create table 'catalogrule' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule')) + ->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + ) + ->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + ) + ->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + ) + ->addColumn( + 'from_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'From Date' + ) + ->addColumn( + 'to_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'To Date' + ) + ->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Is Active' + ) + ->addColumn( + 'conditions_serialized', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Conditions Serialized' + ) + ->addColumn( + 'actions_serialized', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Actions Serialized' + ) + ->addColumn( + 'stop_rules_processing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Stop Rules Processing' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addColumn( + 'simple_action', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Simple Action' + ) + ->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => 0.0000], + 'Discount Amount' + ) + ->addColumn( + 'sub_is_enable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Rule Enable For Subitems' + ) + ->addColumn( + 'sub_simple_action', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Simple Action For Subitems' + ) + ->addColumn( + 'sub_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => 0.0000], + 'Discount Amount For Subitems' + ) + ->addIndex( + $installer->getIdxName('catalogrule', ['is_active', 'sort_order', 'to_date', 'from_date']), + ['is_active', 'sort_order', 'to_date', 'from_date'] + ) + ->setComment('CatalogRule'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_product' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_product')) + ->addColumn( + 'rule_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Product Id' + ) + ->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rule Id' + ) + ->addColumn( + 'from_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'From Time' + ) + ->addColumn( + 'to_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'To time' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Group Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Id' + ) + ->addColumn( + 'action_operator', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 10, + ['default' => 'to_fixed'], + 'Action Operator' + ) + ->addColumn( + 'action_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Action Amount' + ) + ->addColumn( + 'action_stop', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Action Stop' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Website Id' + ) + ->addColumn( + 'sub_simple_action', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Simple Action For Subitems' + ) + ->addColumn( + 'sub_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount For Subitems' + ) + ->addIndex( + $installer->getIdxName( + 'catalogrule_product', + ['rule_id', 'from_time', 'to_time', 'website_id', 'customer_group_id', 'product_id', 'sort_order'], + true + ), + ['rule_id', 'from_time', 'to_time', 'website_id', 'customer_group_id', 'product_id', 'sort_order'], + ['type' => 'unique'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product', ['from_time']), + ['from_time'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product', ['to_time']), + ['to_time'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product', ['product_id']), + ['product_id'] + ) + ->setComment('CatalogRule Product'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_product_price' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_product_price')) + ->addColumn( + 'rule_product_price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Product PriceId' + ) + ->addColumn( + 'rule_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => false], + 'Rule Date' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Group Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Id' + ) + ->addColumn( + 'rule_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Rule Price' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Website Id' + ) + ->addColumn( + 'latest_start_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Latest StartDate' + ) + ->addColumn( + 'earliest_end_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Earliest EndDate' + ) + ->addIndex( + $installer->getIdxName( + 'catalogrule_product_price', + ['rule_date', 'website_id', 'customer_group_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['rule_date', 'website_id', 'customer_group_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product_price', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product_price', ['product_id']), + ['product_id'] + ) + ->setComment('CatalogRule Product Price'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_affected_product' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_affected_product')) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Id' + ) + ->setComment('CatalogRule Affected Product'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_group_website' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_group_website')) + ->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Rule Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Website Id' + ) + ->addIndex( + $installer->getIdxName('catalogrule_group_website', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_group_website', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName('catalogrule_group_website', 'customer_group_id', 'customer_group', 'customer_group_id'), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalogrule_group_website', 'rule_id', 'catalogrule', 'rule_id'), + 'rule_id', + $installer->getTable('catalogrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalogrule_group_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('CatalogRule Group Website'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_website' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_website')) + ->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addIndex( + $installer->getIdxName('catalogrule_website', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName('catalogrule_website', 'rule_id', 'catalogrule', 'rule_id'), + 'rule_id', + $installer->getTable('catalogrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalogrule_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Rules To Websites Relations'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_customer_group' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_customer_group')) + ->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addIndex( + $installer->getIdxName('catalogrule_customer_group', ['customer_group_id']), + ['customer_group_id'] + ) + ->addForeignKey( + $installer->getFkName('catalogrule_customer_group', 'rule_id', 'catalogrule', 'rule_id'), + 'rule_id', + $installer->getTable('catalogrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalogrule_customer_group', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Rules To Customer Groups Relations'); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php new file mode 100644 index 0000000000000..5d195b2766d11 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php @@ -0,0 +1,88 @@ +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->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php new file mode 100644 index 0000000000000..03bb041095d64 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php @@ -0,0 +1,84 @@ +startSetup(); + + $tableName = \Magento\CatalogUrlRewrite\Model\Resource\Category\Product::TABLE_NAME; + $table = $installer->getConnection() + ->newTable($installer->getTable($tableName)) + ->addColumn( + 'url_rewrite_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'url_rewrite_id' + ) + ->addColumn( + 'category_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'category_id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'product_id' + ) + ->addIndex( + $installer->getIdxName($tableName, ['category_id', 'product_id']), + ['category_id', 'product_id'] + ) + ->addForeignKey( + $installer->getFkName($tableName, 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName($tableName, 'category_id', 'catalog_category_entity', 'entity_id'), + 'category_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName($tableName, 'url_rewrite_id', 'url_rewrite', 'url_rewrite_id'), + 'url_rewrite_id', + $installer->getTable('url_rewrite'), + 'url_rewrite_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('url_rewrite_relation'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php new file mode 100644 index 0000000000000..c036fe277b811 --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php @@ -0,0 +1,116 @@ +startSetup(); + + /** + * Create table 'checkout_agreement' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('checkout_agreement') + )->addColumn( + 'agreement_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Agreement Id' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'content', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Content' + )->addColumn( + 'content_height', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 25, + [], + 'Content Height' + )->addColumn( + 'checkbox_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Checkbox Text' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Is Active' + )->addColumn( + 'is_html', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Is Html' + )->setComment( + 'Checkout Agreement' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'checkout_agreement_store' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('checkout_agreement_store') + )->addColumn( + 'agreement_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Agreement Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store Id' + )->addForeignKey( + $installer->getFkName('checkout_agreement_store', 'agreement_id', 'checkout_agreement', 'agreement_id'), + 'agreement_id', + $installer->getTable('checkout_agreement'), + 'agreement_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('checkout_agreement_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Checkout Agreement Store' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Cms/Setup/InstallSchema.php b/app/code/Magento/Cms/Setup/InstallSchema.php new file mode 100644 index 0000000000000..1c1597dead674 --- /dev/null +++ b/app/code/Magento/Cms/Setup/InstallSchema.php @@ -0,0 +1,280 @@ +startSetup(); + + /** + * Create table 'cms_block' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('cms_block') + )->addColumn( + 'block_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Block ID' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Block Title' + )->addColumn( + 'identifier', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Block String Identifier' + )->addColumn( + 'content', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Block Content' + )->addColumn( + 'creation_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Block Creation Time' + )->addColumn( + 'update_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Block Modification Time' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Is Block Active' + )->setComment( + 'CMS Block Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'cms_block_store' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('cms_block_store') + )->addColumn( + 'block_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'primary' => true], + 'Block ID' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + )->addIndex( + $installer->getIdxName('cms_block_store', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('cms_block_store', 'block_id', 'cms_block', 'block_id'), + 'block_id', + $installer->getTable('cms_block'), + 'block_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('cms_block_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'CMS Block To Store Linkage Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'cms_page' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('cms_page') + )->addColumn( + 'page_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Page ID' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Page Title' + )->addColumn( + 'page_layout', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Page Layout' + )->addColumn( + 'meta_keywords', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Page Meta Keywords' + )->addColumn( + 'meta_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Page Meta Description' + )->addColumn( + 'identifier', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['nullable' => true, 'default' => null], + 'Page String Identifier' + )->addColumn( + 'content_heading', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Page Content Heading' + )->addColumn( + 'content', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Page Content' + )->addColumn( + 'creation_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Page Creation Time' + )->addColumn( + 'update_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Page Modification Time' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Is Page Active' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Page Sort Order' + )->addColumn( + 'layout_update_xml', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Page Layout Update Content' + )->addColumn( + 'custom_theme', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['nullable' => true], + 'Page Custom Theme' + )->addColumn( + 'custom_root_template', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Page Custom Template' + )->addColumn( + 'custom_layout_update_xml', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Page Custom Layout Update Content' + )->addColumn( + 'custom_theme_from', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => true], + 'Page Custom Theme Active From Date' + )->addColumn( + 'custom_theme_to', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => true], + 'Page Custom Theme Active To Date' + )->addIndex( + $installer->getIdxName('cms_page', ['identifier']), + ['identifier'] + )->setComment( + 'CMS Page Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'cms_page_store' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('cms_page_store') + )->addColumn( + 'page_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'primary' => true], + 'Page ID' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + )->addIndex( + $installer->getIdxName('cms_page_store', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('cms_page_store', 'page_id', 'cms_page', 'page_id'), + 'page_id', + $installer->getTable('cms_page'), + 'page_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('cms_page_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'CMS Page To Store Linkage Table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php new file mode 100644 index 0000000000000..10191eb0df3ea --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php @@ -0,0 +1,316 @@ +startSetup(); + + /** + * Create table 'catalog_product_super_attribute' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_super_attribute')) + ->addColumn( + 'product_super_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Super Attribute ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Position' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_super_attribute', + ['product_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_id', 'attribute_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_super_attribute', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + ) + ->setComment('Catalog Product Super Attribute Table'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_super_attribute_label' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_super_attribute_label')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_super_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Super Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'use_default', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Use Default Value' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_super_attribute_label', + ['product_super_attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_super_attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_super_attribute_label', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_super_attribute_label', + 'product_super_attribute_id', + 'catalog_product_super_attribute', + 'product_super_attribute_id' + ), + 'product_super_attribute_id', + $installer->getTable('catalog_product_super_attribute'), + 'product_super_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_super_attribute_label', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Super Attribute Label Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_super_attribute_pricing' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_super_attribute_pricing')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_super_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Super Attribute ID' + ) + ->addColumn( + 'value_index', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Value Index' + ) + ->addColumn( + 'is_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Is Percent' + ) + ->addColumn( + 'pricing_value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Pricing Value' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName('catalog_product_super_attribute_pricing', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_super_attribute_pricing', + ['product_super_attribute_id', 'value_index', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_super_attribute_id', 'value_index', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_super_attribute_pricing', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_super_attribute_pricing', + 'product_super_attribute_id', + 'catalog_product_super_attribute', + 'product_super_attribute_id' + ), + 'product_super_attribute_id', + $installer->getTable('catalog_product_super_attribute'), + 'product_super_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Super Attribute Pricing Table'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_super_link' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_super_link')) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Parent ID' + ) + ->addIndex( + $installer->getIdxName('catalog_product_super_link', ['parent_id']), + ['parent_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_super_link', + ['product_id', 'parent_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_id', 'parent_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_super_link', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_super_link', 'parent_id', 'catalog_product_entity', 'entity_id'), + 'parent_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Super Link Table'); + + $installer->getConnection()->createTable($table); + + $table = $installer->getConnection() + ->addColumn( + $installer->getTable('catalog_eav_attribute'), + 'is_configurable', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 'unsigned' => true, + 'default' => null, + 'comment' => 'Can be used to create configurable product' + ] + ); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..bb6605ff4daa7 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php @@ -0,0 +1,36 @@ +getVersion(), '2.0.1') <= 0) { + $installer = $setup; + + $installer->startSetup(); + + $table = $installer->getConnection() + ->dropColumn( + $installer->getTable('catalog_eav_attribute'), + 'is_configurable' + ); + + $installer->endSetup(); + } + } +} \ No newline at end of file diff --git a/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.1.php b/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/upgrade-2.0.0-2.0.1.php similarity index 100% rename from app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.1.php rename to app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/upgrade-2.0.0-2.0.1.php diff --git a/app/code/Magento/Core/Setup/InstallData.php b/app/code/Magento/Core/Setup/InstallData.php new file mode 100755 index 0000000000000..3b98e67b6e783 --- /dev/null +++ b/app/code/Magento/Core/Setup/InstallData.php @@ -0,0 +1,52 @@ +createMigrationSetup(); + $installer->startSetup(); + + $installer->appendClassAliasReplace( + 'core_config_data', + 'value', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['config_id'] + ); + $installer->appendClassAliasReplace( + 'core_layout_update', + 'xml', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, + ['layout_update_id'] + ); + $installer->doUpdateClassAliases(); + + /** + * Delete rows by condition from authorization_rule + */ + $tableName = $installer->getTable('authorization_rule'); + if ($tableName) { + $installer->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']); + } + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Core/Setup/InstallSchema.php b/app/code/Magento/Core/Setup/InstallSchema.php new file mode 100644 index 0000000000000..5ad52a99580e6 --- /dev/null +++ b/app/code/Magento/Core/Setup/InstallSchema.php @@ -0,0 +1,492 @@ +getConnection(); + + $installer->startSetup(); + + /** + * Create table 'core_config_data' + */ + $table = $connection->newTable( + $installer->getTable('core_config_data') + )->addColumn( + 'config_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Config Id' + )->addColumn( + 'scope', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 8, + ['nullable' => false, 'default' => 'default'], + 'Config Scope' + )->addColumn( + 'scope_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Config Scope Id' + )->addColumn( + 'path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false, 'default' => 'general'], + 'Config Path' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Config Value' + )->addIndex( + $installer->getIdxName( + 'core_config_data', + ['scope', 'scope_id', 'path'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['scope', 'scope_id', 'path'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->setComment( + 'Config Data' + ); + $connection->createTable($table); + + /** + * Create table 'core_layout_update' + */ + $table = $connection->newTable( + $installer->getTable('core_layout_update') + )->addColumn( + 'layout_update_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Layout Update Id' + )->addColumn( + 'handle', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Handle' + )->addColumn( + 'xml', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Xml' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Last Update Timestamp' + )->addIndex( + $installer->getIdxName('core_layout_update', ['handle']), + ['handle'] + )->setComment( + 'Layout Updates' + ); + $connection->createTable($table); + + /** + * Create table 'core_layout_link' + */ + $table = $connection->newTable( + $installer->getTable('core_layout_link') + )->addColumn( + 'layout_link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'theme_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Theme id' + )->addColumn( + 'layout_update_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Layout Update Id' + )->addColumn( + 'is_temporary', + \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, + null, + ['nullable' => false, 'default' => '0'], + 'Defines whether Layout Update is Temporary' + )->addIndex( + $installer->getIdxName('core_layout_link', ['layout_update_id']), + ['layout_update_id'] + )->addForeignKey( + $installer->getFkName('core_layout_link', 'layout_update_id', 'core_layout_update', 'layout_update_id'), + 'layout_update_id', + $installer->getTable('core_layout_update'), + 'layout_update_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addIndex( + $installer->getIdxName( + 'core_layout_link', + ['store_id', 'theme_id', 'layout_update_id', 'is_temporary'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['store_id', 'theme_id', 'layout_update_id', 'is_temporary'] + )->addForeignKey( + $installer->getFkName('core_layout_link', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('core_layout_link', 'theme_id', 'theme', 'theme_id'), + 'theme_id', + $installer->getTable('theme'), + 'theme_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Layout Link' + ); + $connection->createTable($table); + + /** + * Create table 'core_session' + */ + $table = $connection->newTable( + $installer->getTable('core_session') + )->addColumn( + 'session_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false, 'primary' => true], + 'Session Id' + )->addColumn( + 'session_expires', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Date of Session Expiration' + )->addColumn( + 'session_data', + \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, + '2M', + ['nullable' => false], + 'Session Data' + )->setComment( + 'Database Sessions Storage' + ); + $connection->createTable($table); + + /** + * Create table 'design_change' + */ + $table = $connection->newTable( + $installer->getTable('design_change') + )->addColumn( + 'design_change_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Design Change Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'design', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Design' + )->addColumn( + 'date_from', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'First Date of Design Activity' + )->addColumn( + 'date_to', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Last Date of Design Activity' + )->addIndex( + $installer->getIdxName('design_change', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('design_change', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Design Changes' + ); + $connection->createTable($table); + + /** + * Create table 'core_variable' + */ + $table = $connection->newTable( + $installer->getTable('core_variable') + )->addColumn( + 'variable_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Variable Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Variable Code' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Variable Name' + )->addIndex( + $installer->getIdxName( + 'core_variable', + ['code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->setComment( + 'Variables' + ); + $connection->createTable($table); + + /** + * Create table 'core_variable_value' + */ + $table = $connection->newTable( + $installer->getTable('core_variable_value') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Variable Value Id' + )->addColumn( + 'variable_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Variable Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'plain_value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Plain Text Value' + )->addColumn( + 'html_value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Html Value' + )->addIndex( + $installer->getIdxName( + 'core_variable_value', + ['variable_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['variable_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('core_variable_value', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('core_variable_value', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('core_variable_value', 'variable_id', 'core_variable', 'variable_id'), + 'variable_id', + $installer->getTable('core_variable'), + 'variable_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Variable Value' + ); + $connection->createTable($table); + + /** + * Create table 'core_cache' + */ + $table = $connection->newTable( + $installer->getTable('core_cache') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + ['nullable' => false, 'primary' => true], + 'Cache Id' + )->addColumn( + 'data', + \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, + '2M', + [], + 'Cache Data' + )->addColumn( + 'create_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Cache Creation Time' + )->addColumn( + 'update_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Time of Cache Updating' + )->addColumn( + 'expire_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Cache Expiration Time' + )->addIndex( + $installer->getIdxName('core_cache', ['expire_time']), + ['expire_time'] + )->setComment( + 'Caches' + ); + $connection->createTable($table); + + /** + * Create table 'core_cache_tag' + */ + $table = $connection->newTable( + $installer->getTable('core_cache_tag') + )->addColumn( + 'tag', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['nullable' => false, 'primary' => true], + 'Tag' + )->addColumn( + 'cache_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + ['nullable' => false, 'primary' => true], + 'Cache Id' + )->addIndex( + $installer->getIdxName('core_cache_tag', ['cache_id']), + ['cache_id'] + )->setComment( + 'Tag Caches' + ); + $connection->createTable($table); + + /** + * Create table 'core_flag' + */ + $table = $connection->newTable( + $installer->getTable('core_flag') + )->addColumn( + 'flag_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Flag Id' + )->addColumn( + 'flag_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Flag Code' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Flag State' + )->addColumn( + 'flag_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Flag Data' + )->addColumn( + 'last_update', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], + 'Date of Last Flag Update' + )->addIndex( + $installer->getIdxName('core_flag', ['last_update']), + ['last_update'] + )->setComment( + 'Flag' + ); + $connection->createTable($table); + + /** + * Drop Foreign Key on core_cache_tag.cache_id + */ + $connection->dropForeignKey( + $installer->getTable('core_cache_tag'), + $installer->getFkName('core_cache_tag', 'cache_id', 'core_cache', 'id') + ); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Cron/Setup/InstallSchema.php b/app/code/Magento/Cron/Setup/InstallSchema.php new file mode 100644 index 0000000000000..8d0a8c67323ba --- /dev/null +++ b/app/code/Magento/Cron/Setup/InstallSchema.php @@ -0,0 +1,93 @@ +startSetup(); + + /** + * Create table 'cron_schedule' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('cron_schedule') + )->addColumn( + 'schedule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Schedule Id' + )->addColumn( + 'job_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false, 'default' => '0'], + 'Job Code' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 7, + ['nullable' => false, 'default' => 'pending'], + 'Status' + )->addColumn( + 'messages', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Messages' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Created At' + )->addColumn( + 'scheduled_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Scheduled At' + )->addColumn( + 'executed_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Executed At' + )->addColumn( + 'finished_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Finished At' + )->addIndex( + $installer->getIdxName('cron_schedule', ['job_code']), + ['job_code'] + )->addIndex( + $installer->getIdxName('cron_schedule', ['scheduled_at', 'status']), + ['scheduled_at', 'status'] + )->setComment( + 'Cron Schedule' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Customer/Setup/InstallData.php b/app/code/Magento/Customer/Setup/InstallData.php index 0c908eb609c52..ac1bfe61983e2 100644 --- a/app/code/Magento/Customer/Setup/InstallData.php +++ b/app/code/Magento/Customer/Setup/InstallData.php @@ -3,6 +3,8 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\Customer\Setup; use Magento\Framework\Module\Setup\Migration; diff --git a/app/code/Magento/Customer/Setup/InstallSchema.php b/app/code/Magento/Customer/Setup/InstallSchema.php new file mode 100644 index 0000000000000..5c2b6d35324a9 --- /dev/null +++ b/app/code/Magento/Customer/Setup/InstallSchema.php @@ -0,0 +1,1199 @@ +startSetup(); + + /** + * Create table 'customer_entity' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true], + 'Website Id' + )->addColumn( + 'email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Email' + )->addColumn( + 'group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Group Id' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Store Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Updated At' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Active' + )->addColumn( + 'disable_auto_group_change', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Disable automatic group change based on VAT ID' + )->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', + ['email', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['email', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('customer_entity', ['website_id']), + ['website_id'] + )->addForeignKey( + $installer->getFkName('customer_entity', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + 50, + [], + 'Increment Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true], + 'Parent Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Updated At' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Active' + )->addIndex( + $installer->getIdxName('customer_address_entity', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('customer_address_entity', 'parent_id', 'customer_entity', 'entity_id'), + 'parent_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity_datetime' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity_datetime') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + ['nullable' => true, 'default' => null], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_address_entity_datetime', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_address_entity_datetime', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_address_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_address_entity_datetime', 'entity_id', 'customer_address_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_address_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity Datetime' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity_decimal' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity_decimal') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_address_entity_decimal', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_address_entity_decimal', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_address_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_address_entity_decimal', 'entity_id', 'customer_address_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_address_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity Decimal' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity_int' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity_int') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_address_entity_int', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_address_entity_int', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_address_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_address_entity_int', 'entity_id', 'customer_address_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_address_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity Int' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity_text' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity_text') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_address_entity_text', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addForeignKey( + $installer->getFkName('customer_address_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_address_entity_text', 'entity_id', 'customer_address_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_address_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity Text' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity_varchar' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity_varchar') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_address_entity_varchar', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_address_entity_varchar', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_address_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_address_entity_varchar', 'entity_id', 'customer_address_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_address_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity Varchar' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_entity_datetime' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity_datetime') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + ['nullable' => true, 'default' => null], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_entity_datetime', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_entity_datetime', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity_datetime', 'entity_id', 'customer_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity Datetime' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_entity_decimal' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity_decimal') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_entity_decimal', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_entity_decimal', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity_decimal', 'entity_id', 'customer_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity Decimal' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_entity_int' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity_int') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_entity_int', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_entity_int', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity_int', 'entity_id', 'customer_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity Int' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_entity_text' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity_text') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_entity_text', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addForeignKey( + $installer->getFkName('customer_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity_text', 'entity_id', 'customer_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity Text' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_entity_varchar' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity_varchar') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_entity_varchar', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_entity_varchar', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity_varchar', 'entity_id', 'customer_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity Varchar' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_group' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_group') + )->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + )->addColumn( + 'customer_group_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Customer Group Code' + )->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Tax Class Id' + )->setComment( + 'Customer Group' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_eav_attribute' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_eav_attribute') + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Id' + )->addColumn( + 'is_visible', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Visible' + )->addColumn( + 'input_filter', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Input Filter' + )->addColumn( + 'multiline_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Multiline Count' + )->addColumn( + 'validate_rules', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Validate Rules' + )->addColumn( + 'is_system', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is System' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + )->addColumn( + 'data_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Data Model' + )->addForeignKey( + $installer->getFkName('customer_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Eav Attribute' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_form_attribute' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_form_attribute') + )->addColumn( + 'form_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Form Code' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Id' + )->addIndex( + $installer->getIdxName('customer_form_attribute', ['attribute_id']), + ['attribute_id'] + )->addForeignKey( + $installer->getFkName('customer_form_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Form Attribute' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_eav_attribute_website' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_eav_attribute_website') + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Id' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + )->addColumn( + 'is_visible', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Visible' + )->addColumn( + 'is_required', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Required' + )->addColumn( + 'default_value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Default Value' + )->addColumn( + 'multiline_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Multiline Count' + )->addIndex( + $installer->getIdxName('customer_eav_attribute_website', ['website_id']), + ['website_id'] + )->addForeignKey( + $installer->getFkName('customer_eav_attribute_website', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_eav_attribute_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Eav Attribute Website' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_visitor' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_visitor') + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Visitor ID' + )->addColumn( + 'session_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => true, 'default' => null], + 'Session ID' + )->addColumn( + 'last_visit_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Last Visit Time' + )->setComment( + 'Visitor Table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Customer/Setup/UpgradeSchema.php b/app/code/Magento/Customer/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..902e33df30af2 --- /dev/null +++ b/app/code/Magento/Customer/Setup/UpgradeSchema.php @@ -0,0 +1,62 @@ +getVersion(), '2.0.0.1') <= 0) { + $installer = $setup; + $installer->startSetup(); + $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_UNIQUE + ) + ); + $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'); + $installer->endSetup(); + } + } +} \ No newline at end of file diff --git a/app/code/Magento/DesignEditor/Setup/InstallSchema.php b/app/code/Magento/DesignEditor/Setup/InstallSchema.php new file mode 100644 index 0000000000000..b2854774a4d3b --- /dev/null +++ b/app/code/Magento/DesignEditor/Setup/InstallSchema.php @@ -0,0 +1,66 @@ +startSetup(); + $connection = $installer->getConnection(); + + /** + * Create table 'vde_theme_change' + */ + $table = $installer->getConnection()->newTable( + $installer->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( + $installer->getFkName('vde_theme_change', 'theme_id', 'theme', 'theme_id'), + 'theme_id', + $installer->getTable('theme'), + 'theme_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Design Editor Theme Change' + ); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Directory/Setup/InstallSchema.php b/app/code/Magento/Directory/Setup/InstallSchema.php new file mode 100644 index 0000000000000..e3c142c96e01f --- /dev/null +++ b/app/code/Magento/Directory/Setup/InstallSchema.php @@ -0,0 +1,205 @@ +startSetup(); + + /** + * Create table 'directory_country' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('directory_country') + )->addColumn( + 'country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + ['nullable' => false, 'primary' => true, 'default' => false], + 'Country Id in ISO-2' + )->addColumn( + 'iso2_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + ['nullable' => true, 'default' => null], + 'Country ISO-2 format' + )->addColumn( + 'iso3_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + ['nullable' => true, 'default' => null], + 'Country ISO-3' + )->setComment( + 'Directory Country' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'directory_country_format' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('directory_country_format') + )->addColumn( + 'country_format_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Country Format Id' + )->addColumn( + 'country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + ['nullable' => true, 'default' => null], + 'Country Id in ISO-2' + )->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 30, + ['nullable' => true, 'default' => null], + 'Country Format Type' + )->addColumn( + 'format', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Country Format' + )->addIndex( + $installer->getIdxName( + 'directory_country_format', + ['country_id', 'type'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['country_id', 'type'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->setComment( + 'Directory Country Format' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'directory_country_region' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('directory_country_region') + )->addColumn( + 'region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Region Id' + )->addColumn( + 'country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 4, + ['nullable' => false, 'default' => '0'], + 'Country Id in ISO-2' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Region code' + )->addColumn( + 'default_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Region Name' + )->addIndex( + $installer->getIdxName('directory_country_region', ['country_id']), + ['country_id'] + )->setComment( + 'Directory Country Region' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'directory_country_region_name' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('directory_country_region_name') + )->addColumn( + 'locale', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 8, + ['nullable' => false, 'primary' => true, 'default' => false], + 'Locale' + )->addColumn( + 'region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Region Id' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Region Name' + )->addIndex( + $installer->getIdxName('directory_country_region_name', ['region_id']), + ['region_id'] + )->addForeignKey( + $installer->getFkName('directory_country_region_name', 'region_id', 'directory_country_region', 'region_id'), + 'region_id', + $installer->getTable('directory_country_region'), + 'region_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Directory Country Region Name' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'directory_currency_rate' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('directory_currency_rate') + )->addColumn( + 'currency_from', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + ['nullable' => false, 'primary' => true, 'default' => false], + 'Currency Code Convert From' + )->addColumn( + 'currency_to', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + ['nullable' => false, 'primary' => true, 'default' => false], + 'Currency Code Convert To' + )->addColumn( + 'rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '24,12', + ['nullable' => false, 'default' => '0.000000000000'], + 'Currency Conversion Rate' + )->addIndex( + $installer->getIdxName('directory_currency_rate', ['currency_to']), + ['currency_to'] + )->setComment( + 'Directory Currency Rate' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Downloadable/Setup/InstallSchema.php b/app/code/Magento/Downloadable/Setup/InstallSchema.php new file mode 100644 index 0000000000000..729f0cc49c2f2 --- /dev/null +++ b/app/code/Magento/Downloadable/Setup/InstallSchema.php @@ -0,0 +1,727 @@ +startSetup(); + + /** + * Create table 'downloadable_link' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_link')) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort order' + ) + ->addColumn( + 'number_of_downloads', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => true], + 'Number of downloads' + ) + ->addColumn( + 'is_shareable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Shareable flag' + ) + ->addColumn( + 'link_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link Url' + ) + ->addColumn( + 'link_file', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link File' + ) + ->addColumn( + 'link_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + [], + 'Link Type' + ) + ->addColumn( + 'sample_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sample Url' + ) + ->addColumn( + 'sample_file', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sample File' + ) + ->addColumn( + 'sample_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + [], + 'Sample Type' + ) + ->addIndex( + $installer->getIdxName('downloadable_link', ['product_id', 'sort_order']), + ['product_id', 'sort_order'] + ) + ->addForeignKey( + $installer->getFkName('downloadable_link', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Link Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_link_price' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_link_price')) + ->addColumn( + 'price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Price ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_price', 'link_id'), + 'link_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_price', 'link_id', 'downloadable_link', 'link_id'), + 'link_id', + $installer->getTable('downloadable_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addIndex( + $installer->getIdxName('downloadable_link_price', 'website_id'), + 'website_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Link Price Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_link_purchased' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_link_purchased')) + ->addColumn( + 'purchased_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Purchased ID' + ) + ->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Order ID' + ) + ->addColumn( + 'order_increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Increment ID' + ) + ->addColumn( + 'order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Order Item ID' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Date of creation' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Date of modification' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true, 'default' => '0'], + 'Customer ID' + ) + ->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Product name' + ) + ->addColumn( + 'product_sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Product sku' + ) + ->addColumn( + 'link_section_title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link_section_title' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased', 'order_id'), + 'order_id' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased', 'order_item_id'), + 'order_item_id' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased', 'customer_id'), + 'customer_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_purchased', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_purchased', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Link Purchased Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_link_purchased_item' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_link_purchased_item')) + ->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Item ID' + ) + ->addColumn( + 'purchased_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Purchased ID' + ) + ->addColumn( + 'order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Order Item ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'link_hash', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link hash' + ) + ->addColumn( + 'number_of_downloads_bought', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Number of downloads bought' + ) + ->addColumn( + 'number_of_downloads_used', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Number of downloads used' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link ID' + ) + ->addColumn( + 'link_title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link Title' + ) + ->addColumn( + 'is_shareable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Shareable Flag' + ) + ->addColumn( + 'link_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link Url' + ) + ->addColumn( + 'link_file', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link File' + ) + ->addColumn( + 'link_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link Type' + ) + ->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Status' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Creation Time' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Update Time' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased_item', 'link_hash'), + 'link_hash' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased_item', 'order_item_id'), + 'order_item_id' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased_item', 'purchased_id'), + 'purchased_id' + ) + ->addForeignKey( + $installer->getFkName( + 'downloadable_link_purchased_item', + 'purchased_id', + 'downloadable_link_purchased', + 'purchased_id' + ), + 'purchased_id', + $installer->getTable('downloadable_link_purchased'), + 'purchased_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_purchased_item', 'order_item_id', 'sales_order_item', 'item_id'), + 'order_item_id', + $installer->getTable('sales_order_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Link Purchased Item Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_link_title' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_link_title')) + ->addColumn( + 'title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Title ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'downloadable_link_title', + ['link_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['link_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_title', 'link_id', 'downloadable_link', 'link_id'), + 'link_id', + $installer->getTable('downloadable_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addIndex( + $installer->getIdxName('downloadable_link_title', 'store_id'), + 'store_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Link Title Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_sample' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_sample')) + ->addColumn( + 'sample_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Sample ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'sample_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sample URL' + ) + ->addColumn( + 'sample_file', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sample file' + ) + ->addColumn( + 'sample_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + [], + 'Sample Type' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addIndex( + $installer->getIdxName('downloadable_sample', 'product_id'), + 'product_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_sample', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Sample Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_sample_title' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_sample_title')) + ->addColumn( + 'title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Title ID' + ) + ->addColumn( + 'sample_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sample ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'downloadable_sample_title', + ['sample_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['sample_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('downloadable_sample_title', 'sample_id', 'downloadable_sample', 'sample_id'), + 'sample_id', + $installer->getTable('downloadable_sample'), + 'sample_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addIndex( + $installer->getIdxName('downloadable_sample_title', 'store_id'), + 'store_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_sample_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Sample Title Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_downlod_idx' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_downlod_idx')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Minimum price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Maximum price' + ) + ->setComment('Indexer Table for price of downloadable products'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_downlod_tmp' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_downlod_tmp')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Minimum price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Maximum price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment('Temporary Indexer Table for price of downloadable products'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Eav/Setup/InstallSchema.php b/app/code/Magento/Eav/Setup/InstallSchema.php new file mode 100644 index 0000000000000..b96a53e8165f5 --- /dev/null +++ b/app/code/Magento/Eav/Setup/InstallSchema.php @@ -0,0 +1,1451 @@ +startSetup(); + + /** + * Create table 'eav_entity_type' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_type') + )->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Type Id' + )->addColumn( + 'entity_type_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false], + 'Entity Type Code' + )->addColumn( + 'entity_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Entity Model' + )->addColumn( + 'attribute_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Attribute Model' + )->addColumn( + 'entity_table', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Entity Table' + )->addColumn( + 'value_table_prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value Table Prefix' + )->addColumn( + 'entity_id_field', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Entity Id Field' + )->addColumn( + 'is_data_sharing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Defines Is Data Sharing' + )->addColumn( + 'data_sharing_key', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['default' => 'default'], + 'Data Sharing Key' + )->addColumn( + 'default_attribute_set_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Default Attribute Set Id' + )->addColumn( + 'increment_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => false], + 'Increment Model' + )->addColumn( + 'increment_per_store', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Increment Per Store' + )->addColumn( + 'increment_pad_length', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '8'], + 'Increment Pad Length' + )->addColumn( + 'increment_pad_char', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 1, + ['nullable' => false, 'default' => '0'], + 'Increment Pad Char' + )->addColumn( + 'additional_attribute_table', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => false], + 'Additional Attribute Table' + )->addColumn( + 'entity_attribute_collection', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Entity Attribute Collection' + )->addIndex( + $installer->getIdxName('eav_entity_type', ['entity_type_code']), + ['entity_type_code'] + )->setComment( + 'Eav Entity Type' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + 50, + ['nullable' => true, 'default' => null], + 'Increment Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Parent Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Updated At' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Defines Is Entity Active' + )->addIndex( + $installer->getIdxName('eav_entity', ['entity_type_id']), + ['entity_type_id'] + )->addIndex( + $installer->getIdxName('eav_entity', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_datetime' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_datetime') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + ['nullable' => true, 'default' => null], + 'Attribute Value' + )->addIndex( + $installer->getIdxName('eav_entity_datetime', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('eav_entity_datetime', ['attribute_id', 'value']), + ['attribute_id', 'value'] + )->addIndex( + $installer->getIdxName('eav_entity_datetime', ['entity_type_id', 'value']), + ['entity_type_id', 'value'] + )->addIndex( + $installer->getIdxName( + 'eav_entity_datetime', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_entity_datetime', 'entity_id', 'eav_entity', 'entity_id'), + 'entity_id', + $installer->getTable('eav_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_datetime', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Value Prefix' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_decimal' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_decimal') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Attribute Value' + )->addIndex( + $installer->getIdxName('eav_entity_decimal', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('eav_entity_decimal', ['attribute_id', 'value']), + ['attribute_id', 'value'] + )->addIndex( + $installer->getIdxName('eav_entity_decimal', ['entity_type_id', 'value']), + ['entity_type_id', 'value'] + )->addIndex( + $installer->getIdxName( + 'eav_entity_decimal', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_entity_decimal', 'entity_id', 'eav_entity', 'entity_id'), + 'entity_id', + $installer->getTable('eav_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Value Prefix' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_int' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_int') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Attribute Value' + )->addIndex( + $installer->getIdxName('eav_entity_int', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('eav_entity_int', ['attribute_id', 'value']), + ['attribute_id', 'value'] + )->addIndex( + $installer->getIdxName('eav_entity_int', ['entity_type_id', 'value']), + ['entity_type_id', 'value'] + )->addIndex( + $installer->getIdxName( + 'eav_entity_int', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_entity_int', 'entity_id', 'eav_entity', 'entity_id'), + 'entity_id', + $installer->getTable('eav_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_int', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Value Prefix' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_text' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_text') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Attribute Value' + )->addIndex( + $installer->getIdxName('eav_entity_text', ['entity_type_id']), + ['entity_type_id'] + )->addIndex( + $installer->getIdxName('eav_entity_text', ['attribute_id']), + ['attribute_id'] + )->addIndex( + $installer->getIdxName('eav_entity_text', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName( + 'eav_entity_text', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_entity_text', 'entity_id', 'eav_entity', 'entity_id'), + 'entity_id', + $installer->getTable('eav_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_text', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Value Prefix' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_varchar' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_varchar') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Attribute Value' + )->addIndex( + $installer->getIdxName('eav_entity_varchar', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('eav_entity_varchar', ['attribute_id', 'value']), + ['attribute_id', 'value'] + )->addIndex( + $installer->getIdxName('eav_entity_varchar', ['entity_type_id', 'value']), + ['entity_type_id', 'value'] + )->addIndex( + $installer->getIdxName( + 'eav_entity_varchar', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_entity_varchar', 'entity_id', 'eav_entity', 'entity_id'), + 'entity_id', + $installer->getTable('eav_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_varchar', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Value Prefix' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute') + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Id' + )->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type Id' + )->addColumn( + 'attribute_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Attribute Code' + )->addColumn( + 'attribute_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Attribute Model' + )->addColumn( + 'backend_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Backend Model' + )->addColumn( + 'backend_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 8, + ['nullable' => false, 'default' => 'static'], + 'Backend Type' + )->addColumn( + 'backend_table', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Backend Table' + )->addColumn( + 'frontend_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Frontend Model' + )->addColumn( + 'frontend_input', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Frontend Input' + )->addColumn( + 'frontend_label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Frontend Label' + )->addColumn( + 'frontend_class', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Frontend Class' + )->addColumn( + 'source_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Source Model' + )->addColumn( + 'is_required', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Defines Is Required' + )->addColumn( + 'is_user_defined', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Defines Is User Defined' + )->addColumn( + 'default_value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Default Value' + )->addColumn( + 'is_unique', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Defines Is Unique' + )->addColumn( + 'note', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Note' + )->addIndex( + $installer->getIdxName( + 'eav_attribute', + ['entity_type_id', 'attribute_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'attribute_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_attribute', '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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_store' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_store') + )->addColumn( + 'entity_store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Store Id' + )->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'increment_prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + ['nullable' => true], + 'Increment Prefix' + )->addColumn( + 'increment_last_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => true], + 'Last Incremented Id' + )->addIndex( + $installer->getIdxName('eav_entity_store', ['entity_type_id']), + ['entity_type_id'] + )->addIndex( + $installer->getIdxName('eav_entity_store', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('eav_entity_store', '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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Store' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute_set' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute_set') + )->addColumn( + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Set 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_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Attribute Set Name' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addIndex( + $installer->getIdxName( + 'eav_attribute_set', + ['entity_type_id', 'attribute_set_name'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'attribute_set_name'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('eav_attribute_set', ['entity_type_id', 'sort_order']), + ['entity_type_id', 'sort_order'] + )->addForeignKey( + $installer->getFkName('eav_attribute_set', '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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute Set' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute_group' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute_group') + )->addColumn( + 'attribute_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Group Id' + )->addColumn( + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Set Id' + )->addColumn( + 'attribute_group_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Attribute Group Name' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addColumn( + 'default_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Default Id' + )->addColumn( + 'attribute_group_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['default' => null], + 'Attribute Group Code' + )->addColumn( + 'tab_group_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['default' => null], + 'Tab Group Code' + )->addIndex( + $installer->getIdxName( + 'eav_attribute_group', + ['attribute_set_id', 'attribute_group_name'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['attribute_set_id', 'attribute_group_name'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('eav_attribute_group', ['attribute_set_id', 'sort_order']), + ['attribute_set_id', 'sort_order'] + )->addForeignKey( + $installer->getFkName('eav_attribute_group', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), + 'attribute_set_id', + $installer->getTable('eav_attribute_set'), + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute Group' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_attribute' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_attribute') + )->addColumn( + 'entity_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Attribute 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( + 'attribute_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Group Id' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addIndex( + $installer->getIdxName( + 'eav_entity_attribute', + ['attribute_set_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['attribute_set_id', 'attribute_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName( + 'eav_entity_attribute', + ['attribute_group_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['attribute_group_id', 'attribute_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('eav_entity_attribute', ['attribute_set_id', 'sort_order']), + ['attribute_set_id', 'sort_order'] + )->addIndex( + $installer->getIdxName('eav_entity_attribute', ['attribute_id']), + ['attribute_id'] + )->addForeignKey( + $installer->getFkName('eav_entity_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_attribute', 'attribute_group_id', 'eav_attribute_group', 'attribute_group_id'), + 'attribute_group_id', + $installer->getTable('eav_attribute_group'), + 'attribute_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Attributes' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute_option' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute_option') + )->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Id' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + )->addIndex( + $installer->getIdxName('eav_attribute_option', ['attribute_id']), + ['attribute_id'] + )->addForeignKey( + $installer->getFkName('eav_attribute_option', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute Option' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute_option_value' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute_option_value') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value Id' + )->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Value' + )->addIndex( + $installer->getIdxName('eav_attribute_option_value', ['option_id']), + ['option_id'] + )->addIndex( + $installer->getIdxName('eav_attribute_option_value', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('eav_attribute_option_value', 'option_id', 'eav_attribute_option', 'option_id'), + 'option_id', + $installer->getTable('eav_attribute_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_attribute_option_value', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute Option Value' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute_label' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute_label') + )->addColumn( + 'attribute_label_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Label Id' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Value' + )->addIndex( + $installer->getIdxName('eav_attribute_label', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('eav_attribute_label', ['attribute_id', 'store_id']), + ['attribute_id', 'store_id'] + )->addForeignKey( + $installer->getFkName('eav_attribute_label', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_attribute_label', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute Label' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_form_type' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_form_type') + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Type Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => false], + 'Code' + )->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Label' + )->addColumn( + 'is_system', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is System' + )->addColumn( + 'theme', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => true], + 'Theme' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + )->addIndex( + $installer->getIdxName( + 'eav_form_type', + ['code', 'theme', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['code', 'theme', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('eav_form_type', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('eav_form_type', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Form Type' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_form_type_entity' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_form_type_entity') + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Type Id' + )->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Type Id' + )->addIndex( + $installer->getIdxName('eav_form_type_entity', ['entity_type_id']), + ['entity_type_id'] + )->addForeignKey( + $installer->getFkName('eav_form_type_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_form_type_entity', 'type_id', 'eav_form_type', 'type_id'), + 'type_id', + $installer->getTable('eav_form_type'), + 'type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Form Type Entity' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_form_fieldset' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_form_fieldset') + )->addColumn( + 'fieldset_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Fieldset Id' + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Type Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => false], + 'Code' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addIndex( + $installer->getIdxName( + 'eav_form_fieldset', + ['type_id', 'code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['type_id', 'code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_form_fieldset', 'type_id', 'eav_form_type', 'type_id'), + 'type_id', + $installer->getTable('eav_form_type'), + 'type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Form Fieldset' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_form_fieldset_label' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_form_fieldset_label') + )->addColumn( + 'fieldset_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Fieldset Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store Id' + )->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Label' + )->addIndex( + $installer->getIdxName('eav_form_fieldset_label', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('eav_form_fieldset_label', 'fieldset_id', 'eav_form_fieldset', 'fieldset_id'), + 'fieldset_id', + $installer->getTable('eav_form_fieldset'), + 'fieldset_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_form_fieldset_label', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Form Fieldset Label' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_form_element' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_form_element') + )->addColumn( + 'element_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Element Id' + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Type Id' + )->addColumn( + 'fieldset_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Fieldset Id' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Attribute Id' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addIndex( + $installer->getIdxName( + 'eav_form_element', + ['type_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['type_id', 'attribute_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('eav_form_element', ['fieldset_id']), + ['fieldset_id'] + )->addIndex( + $installer->getIdxName('eav_form_element', ['attribute_id']), + ['attribute_id'] + )->addForeignKey( + $installer->getFkName('eav_form_element', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_form_element', 'fieldset_id', 'eav_form_fieldset', 'fieldset_id'), + 'fieldset_id', + $installer->getTable('eav_form_fieldset'), + 'fieldset_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_form_element', 'type_id', 'eav_form_type', 'type_id'), + 'type_id', + $installer->getTable('eav_form_type'), + 'type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Form Element' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Email/Setup/InstallSchema.php b/app/code/Magento/Email/Setup/InstallSchema.php new file mode 100644 index 0000000000000..1d03181be4f54 --- /dev/null +++ b/app/code/Magento/Email/Setup/InstallSchema.php @@ -0,0 +1,122 @@ +getConnection()->newTable( + $installer->getTable('email_template') + )->addColumn( + 'template_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Template Id' + )->addColumn( + 'template_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 150, + ['nullable' => false], + 'Template Name' + )->addColumn( + 'template_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Template Content' + )->addColumn( + 'template_styles', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Templste Styles' + )->addColumn( + 'template_type', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Template Type' + )->addColumn( + 'template_subject', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + ['nullable' => false], + 'Template Subject' + )->addColumn( + 'template_sender_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Template Sender Name' + )->addColumn( + 'template_sender_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Template Sender Email' + )->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Date of Template Creation' + )->addColumn( + 'modified_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Date of Template Modification' + )->addColumn( + 'orig_template_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Original Template Code' + )->addColumn( + 'orig_template_variables', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Original Template Variables' + )->addIndex( + $installer->getIdxName( + 'email_template', + ['template_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['template_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('email_template', ['added_at']), + ['added_at'] + )->addIndex( + $installer->getIdxName('email_template', ['modified_at']), + ['modified_at'] + )->setComment( + 'Email Templates' + ); + + $installer->getConnection()->createTable($table); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Fedex/Setup/InstallData.php b/app/code/Magento/Fedex/Setup/InstallData.php new file mode 100755 index 0000000000000..ac70e93c4cb60 --- /dev/null +++ b/app/code/Magento/Fedex/Setup/InstallData.php @@ -0,0 +1,107 @@ + [ + 'EUROPEFIRSTINTERNATIONALPRIORITY' => 'EUROPE_FIRST_INTERNATIONAL_PRIORITY', + 'FEDEX1DAYFREIGHT' => 'FEDEX_1_DAY_FREIGHT', + 'FEDEX2DAYFREIGHT' => 'FEDEX_2_DAY_FREIGHT', + 'FEDEX2DAY' => 'FEDEX_2_DAY', + 'FEDEX3DAYFREIGHT' => 'FEDEX_3_DAY_FREIGHT', + 'FEDEXEXPRESSSAVER' => 'FEDEX_EXPRESS_SAVER', + 'FEDEXGROUND' => 'FEDEX_GROUND', + 'FIRSTOVERNIGHT' => 'FIRST_OVERNIGHT', + 'GROUNDHOMEDELIVERY' => 'GROUND_HOME_DELIVERY', + 'INTERNATIONALECONOMY' => 'INTERNATIONAL_ECONOMY', + 'INTERNATIONALECONOMY FREIGHT' => 'INTERNATIONAL_ECONOMY_FREIGHT', + 'INTERNATIONALFIRST' => 'INTERNATIONAL_FIRST', + 'INTERNATIONALGROUND' => 'INTERNATIONAL_GROUND', + 'INTERNATIONALPRIORITY' => 'INTERNATIONAL_PRIORITY', + 'INTERNATIONALPRIORITY FREIGHT' => 'INTERNATIONAL_PRIORITY_FREIGHT', + 'PRIORITYOVERNIGHT' => 'PRIORITY_OVERNIGHT', + 'SMARTPOST' => 'SMART_POST', + 'STANDARDOVERNIGHT' => 'STANDARD_OVERNIGHT', + 'FEDEXFREIGHT' => 'FEDEX_FREIGHT', + 'FEDEXNATIONALFREIGHT' => 'FEDEX_NATIONAL_FREIGHT', + ], + 'dropoff' => [ + 'REGULARPICKUP' => 'REGULAR_PICKUP', + 'REQUESTCOURIER' => 'REQUEST_COURIER', + 'DROPBOX' => 'DROP_BOX', + 'BUSINESSSERVICECENTER' => 'BUSINESS_SERVICE_CENTER', + 'STATION' => 'STATION', + ], + 'packaging' => [ + 'FEDEXENVELOPE' => 'FEDEX_ENVELOPE', + 'FEDEXPAK' => 'FEDEX_PAK', + 'FEDEXBOX' => 'FEDEX_BOX', + 'FEDEXTUBE' => 'FEDEX_TUBE', + 'FEDEX10KGBOX' => 'FEDEX_10KG_BOX', + 'FEDEX25KGBOX' => 'FEDEX_25KG_BOX', + 'YOURPACKAGING' => 'YOUR_PACKAGING', + ], + ]; + + $installer = $setup; + $configDataTable = $installer->getTable('core_config_data'); + $conn = $installer->getConnection(); + + $select = $conn->select()->from( + $configDataTable + )->where( + 'path IN (?)', + [ + 'carriers/fedex/packaging', + 'carriers/fedex/dropoff', + 'carriers/fedex/free_method', + 'carriers/fedex/allowed_methods' + ] + ); + $mapsOld = $conn->fetchAll($select); + foreach ($mapsOld as $mapOld) { + $mapNew = ''; + if (stripos($mapOld['path'], 'packaging') && isset($codes['packaging'][$mapOld['value']])) { + $mapNew = $codes['packaging'][$mapOld['value']]; + } elseif (stripos($mapOld['path'], 'dropoff') && isset($codes['dropoff'][$mapOld['value']])) { + $mapNew = $codes['dropoff'][$mapOld['value']]; + } elseif (stripos($mapOld['path'], 'free_method') && isset($codes['method'][$mapOld['value']])) { + $mapNew = $codes['method'][$mapOld['value']]; + } elseif (stripos($mapOld['path'], 'allowed_methods')) { + foreach (explode(',', $mapOld['value']) as $shippingMethod) { + if (isset($codes['method'][$shippingMethod])) { + $mapNew[] = $codes['method'][$shippingMethod]; + } else { + $mapNew[] = $shippingMethod; + } + } + $mapNew = implode($mapNew, ','); + } else { + continue; + } + + if (!empty($mapNew) && $mapNew != $mapOld['value']) { + $whereConfigId = $conn->quoteInto('config_id = ?', $mapOld['config_id']); + $conn->update($configDataTable, ['value' => $mapNew], $whereConfigId); + } + } + + } +} \ No newline at end of file diff --git a/app/code/Magento/GiftMessage/Setup/InstallSchema.php b/app/code/Magento/GiftMessage/Setup/InstallSchema.php new file mode 100644 index 0000000000000..99a5c498691ac --- /dev/null +++ b/app/code/Magento/GiftMessage/Setup/InstallSchema.php @@ -0,0 +1,69 @@ +startSetup(); + + /** + * Create table 'gift_message' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('gift_message') + )->addColumn( + 'gift_message_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'GiftMessage Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer id' + )->addColumn( + 'sender', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sender' + )->addColumn( + 'recipient', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Recipient' + )->addColumn( + 'message', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'Message' + )->setComment( + 'Gift Message' + ); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php new file mode 100644 index 0000000000000..c86102f23eb97 --- /dev/null +++ b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php @@ -0,0 +1,89 @@ +startSetup(); + + /** + * Create table 'googleoptimizer_code' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('googleoptimizer_code')) + ->addColumn( + 'code_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Google experiment code id' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Optimized entity id product id or catalog id' + ) + ->addColumn( + 'entity_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Optimized entity type' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store id' + ) + ->addColumn( + 'experiment_script', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Google experiment script' + ) + ->addIndex( + $installer->getIdxName( + 'googleoptimizer_code', + ['store_id', 'entity_id', 'entity_type'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['store_id', 'entity_id', 'entity_type'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('googleoptimizer_code', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Google Experiment code'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/GoogleShopping/Setup/InstallData.php b/app/code/Magento/GoogleShopping/Setup/InstallData.php index e176f8d3a9ad4..217f04ec90e36 100644 --- a/app/code/Magento/GoogleShopping/Setup/InstallData.php +++ b/app/code/Magento/GoogleShopping/Setup/InstallData.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\GoogleShopping\Setup; use Magento\Framework\Module\Manager; diff --git a/app/code/Magento/GoogleShopping/Setup/InstallSchema.php b/app/code/Magento/GoogleShopping/Setup/InstallSchema.php new file mode 100644 index 0000000000000..2d03fcb2b7ac9 --- /dev/null +++ b/app/code/Magento/GoogleShopping/Setup/InstallSchema.php @@ -0,0 +1,196 @@ +startSetup(); + + $connection = $installer->getConnection(); + + $table = $connection->newTable($setup->getTable('googleshopping_types')) + ->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Type ID' + ) + ->addColumn( + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Attribute Set Id' + ) + ->addColumn( + 'target_country', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + ['nullable' => false, 'default' => 'US'], + 'Target country' + ) + ->addColumn( + 'category', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Google product category' + ) + ->addForeignKey( + $installer->getFkName('googleshopping_types', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), + 'attribute_set_id', + $setup->getTable('eav_attribute_set'), + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addIndex( + $installer->getIdxName( + 'googleshopping_types', + ['attribute_set_id', 'target_country'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['attribute_set_id', 'target_country'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->setComment('Google Content Item Types link Attribute Sets'); + $installer->getConnection()->createTable($table); + + $table = $connection->newTable($setup->getTable('googleshopping_items')) + ->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'unsigned' => true, 'primary' => true], + 'Item Id' + ) + ->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true, 'default' => 0], + 'Type Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Product Id' + ) + ->addColumn( + 'gcontent_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Google Content Item Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'unsigned' => true], + 'Store Id' + ) + ->addColumn( + 'published', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Published date' + ) + ->addColumn( + 'expires', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Expires date' + ) + ->addForeignKey( + $installer->getFkName('googleshopping_items', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $setup->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('googleshopping_items', 'store_id', 'store', 'store_id'), + 'store_id', + $setup->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addIndex( + $installer->getIdxName('googleshopping_items', ['product_id', 'store_id']), + ['product_id', 'store_id'] + ) + ->setComment('Google Content Items Products'); + $installer->getConnection()->createTable($table); + + $table = $connection->newTable($setup->getTable('googleshopping_attributes')) + ->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 10, + ['identity' => true, 'nullable' => false, 'unsigned' => true, 'primary' => true], + 'Id' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'unsigned' => true], + 'Attribute Id' + ) + ->addColumn( + 'gcontent_attribute', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Google Content Attribute' + ) + ->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Type Id' + ) + ->addForeignKey( + $installer->getFkName('googleshopping_attributes', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $setup->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('googleshopping_attributes', 'type_id', 'googleshopping_types', 'type_id'), + 'type_id', + $setup->getTable('googleshopping_types'), + 'type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Google Content Attributes link Product Attributes'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/ImportExport/Setup/InstallSchema.php b/app/code/Magento/ImportExport/Setup/InstallSchema.php new file mode 100644 index 0000000000000..453b7041a7145 --- /dev/null +++ b/app/code/Magento/ImportExport/Setup/InstallSchema.php @@ -0,0 +1,64 @@ +startSetup(); + + /** + * Create table 'importexport_importdata' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('importexport_importdata')) + ->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + ) + ->addColumn( + 'entity', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false], + 'Entity' + ) + ->addColumn( + 'behavior', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 10, + ['nullable' => false, 'default' => 'append'], + 'Behavior' + ) + ->addColumn( + 'data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '4G', + ['default' => false], + 'Data' + ) + ->setComment('Import Data Table'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Indexer/Setup/InstallSchema.php b/app/code/Magento/Indexer/Setup/InstallSchema.php new file mode 100644 index 0000000000000..30fd4a40e76d6 --- /dev/null +++ b/app/code/Magento/Indexer/Setup/InstallSchema.php @@ -0,0 +1,132 @@ +startSetup(); + + /** + * Create table 'indexer_state' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('indexer_state')) + ->addColumn( + 'state_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Indexer State Id' + ) + ->addColumn( + 'indexer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Indexer Id' + ) + ->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['default' => 'invalid'], + 'Indexer Status' + ) + ->addColumn( + 'updated', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Indexer Status' + ) + ->addIndex( + $installer->getIdxName('indexer_state', ['indexer_id']), + ['indexer_id'] + ) + ->setComment('Indexer State'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'mview_state' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('mview_state')) + ->addColumn( + 'state_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [ + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ], + 'View State Id' + ) + ->addColumn( + 'view_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'View Id' + ) + ->addColumn( + 'mode', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['default' => 'disabled'], + 'View Mode' + ) + ->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['default' => 'idle'], + 'View Status' + ) + ->addColumn( + 'updated', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'View updated time' + ) + ->addColumn( + 'version_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'View Version Id' + ) + ->addIndex( + $installer->getIdxName('mview_state', ['view_id']), + ['view_id'] + ) + ->addIndex( + $installer->getIdxName('mview_state', ['mode']), + ['mode'] + ) + ->setComment('View State'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Integration/Setup/InstallSchema.php b/app/code/Magento/Integration/Setup/InstallSchema.php new file mode 100644 index 0000000000000..34760c4917ce4 --- /dev/null +++ b/app/code/Magento/Integration/Setup/InstallSchema.php @@ -0,0 +1,371 @@ +startSetup(); + + /** + * Create table 'oauth_consumer' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('oauth_consumer') + )->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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Updated At' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Name of consumer' + )->addColumn( + 'key', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Key code' + )->addColumn( + 'secret', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Secret code' + )->addColumn( + 'callback_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Callback URL' + )->addColumn( + 'rejected_callback_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Rejected callback URL' + )->addIndex( + $installer->getIdxName( + $installer->getTable('oauth_consumer'), + ['key'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['key'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName( + $installer->getTable('oauth_consumer'), + ['secret'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['secret'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('oauth_consumer', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('oauth_consumer', ['updated_at']), + ['updated_at'] + )->setComment( + 'OAuth Consumers' + ); + $installer->getConnection()->createTable($table); + + $adminTable = $installer->getTable('admin_user'); + $customerTable = $installer->getTable('customer_entity'); + + /** + * Create table 'oauth_token' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('oauth_token') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + )->addColumn( + 'consumer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true], + 'Oauth Consumer ID' + )->addColumn( + 'admin_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true], + 'Admin user ID' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true], + 'Customer user ID' + )->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['nullable' => false], + 'Token Type' + )->addColumn( + 'token', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Token' + )->addColumn( + 'secret', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Token Secret' + )->addColumn( + 'verifier', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true], + 'Token Verifier' + )->addColumn( + 'callback_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Token Callback URL' + )->addColumn( + 'revoked', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Is Token revoked' + )->addColumn( + 'authorized', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Is Token authorized' + )->addColumn( + 'user_type', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'User type' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], + 'Token creation timestamp' + )->addIndex( + $installer->getIdxName( + $installer->getTable('oauth_token'), + ['consumer_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX + ), + ['consumer_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX] + )->addIndex( + $installer->getIdxName( + $installer->getTable('oauth_token'), + ['token'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['token'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('oauth_token', 'admin_id', 'admin_user', 'user_id'), + 'admin_id', + $installer->getTable('admin_user'), + 'user_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('oauth_token', 'consumer_id', 'oauth_consumer', 'entity_id'), + 'consumer_id', + $installer->getTable('oauth_consumer'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('oauth_token', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'OAuth Tokens' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'oauth_nonce' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('oauth_nonce') + )->addColumn( + 'nonce', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Nonce String' + )->addColumn( + 'timestamp', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 10, + ['unsigned' => true, 'nullable' => false], + 'Nonce Timestamp' + )->addColumn( + 'consumer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Consumer ID' + )->addIndex( + $installer->getIdxName( + $installer->getTable('oauth_nonce'), + ['nonce', 'consumer_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['nonce', 'consumer_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('oauth_nonce', 'consumer_id', 'oauth_consumer', 'entity_id'), + 'consumer_id', + $installer->getTable('oauth_consumer'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'OAuth Nonce' + )->setOption( + 'type', + 'MyISAM' + ); + $installer->getConnection()->createTable($table); + + $table = $installer->getConnection()->newTable( + $installer->getTable('integration') + )->addColumn( + 'integration_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Integration ID' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Integration name is displayed in the admin interface' + )->addColumn( + 'email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Email address of the contact person' + )->addColumn( + 'endpoint', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Endpoint for posting consumer credentials' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Integration status' + )->addColumn( + 'consumer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Oauth consumer' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Creation Time' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Update Time' + )->addColumn( + 'setup_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Integration type - manual or config file' + )->addColumn( + 'identity_link_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Identity linking Url' + )->addIndex( + $installer->getIdxName( + $installer->getTable('integration'), + ['name'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['name'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName( + $installer->getTable('integration'), + ['consumer_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['consumer_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('integration', 'consumer_id', $installer->getTable('oauth_consumer'), 'entity_id'), + 'consumer_id', + $installer->getTable('oauth_consumer'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Log/Setup/InstallData.php b/app/code/Magento/Log/Setup/InstallData.php new file mode 100755 index 0000000000000..3ae16d3f0bd9a --- /dev/null +++ b/app/code/Magento/Log/Setup/InstallData.php @@ -0,0 +1,34 @@ + 1, 'type_code' => 'hour', 'period' => 1, 'period_type' => 'HOUR'], + ['type_id' => 2, 'type_code' => 'day', 'period' => 1, 'period_type' => 'DAY'], + ]; + + foreach ($data as $bind) { + $installer->getConnection()->insertForce($installer->getTable('log_summary_type'), $bind); + } + + } +} \ No newline at end of file diff --git a/app/code/Magento/Log/Setup/InstallSchema.php b/app/code/Magento/Log/Setup/InstallSchema.php new file mode 100644 index 0000000000000..f5266192c2b28 --- /dev/null +++ b/app/code/Magento/Log/Setup/InstallSchema.php @@ -0,0 +1,404 @@ +startSetup(); + + /** + * Create table 'log_customer' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_customer') + )->addColumn( + 'log_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Log ID' + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true], + 'Visitor ID' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Customer ID' + )->addColumn( + 'login_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Login Time' + )->addColumn( + 'logout_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Logout Time' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store ID' + )->addIndex( + $installer->getIdxName('log_customer', ['visitor_id']), + ['visitor_id'] + )->setComment( + 'Log Customers Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_quote' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_quote') + )->addColumn( + 'quote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Quote ID' + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true], + 'Visitor ID' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Creation Time' + )->addColumn( + 'deleted_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Deletion Time' + )->setComment( + 'Log Quotes Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_summary' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_summary') + )->addColumn( + 'summary_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Summary ID' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store ID' + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Type ID' + )->addColumn( + 'visitor_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Visitor Count' + )->addColumn( + 'customer_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Customer Count' + )->addColumn( + 'add_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Date' + )->setComment( + 'Log Summary Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_summary_type' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_summary_type') + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Type ID' + )->addColumn( + 'type_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => true, 'default' => null], + 'Type Code' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Period' + )->addColumn( + 'period_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 6, + ['nullable' => false, 'default' => 'MINUTE'], + 'Period Type' + )->setComment( + 'Log Summary Types Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_url' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_url') + )->addColumn( + 'url_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'URL ID' + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true], + 'Visitor ID' + )->addColumn( + 'visit_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Visit Time' + )->addIndex( + $installer->getIdxName('log_url', ['visitor_id']), + ['visitor_id'] + )->setComment( + 'Log URL Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_url_info' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_url_info') + )->addColumn( + 'url_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'URL ID' + )->addColumn( + 'url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'URL' + )->addColumn( + 'referer', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Referrer' + )->setComment( + 'Log URL Info Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_visitor' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_visitor') + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Visitor ID' + )->addColumn( + 'first_visit_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'First Visit Time' + )->addColumn( + 'last_visit_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Last Visit Time' + )->addColumn( + 'last_url_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Last URL ID' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store ID' + )->setComment( + 'Log Visitors Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_visitor_info' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_visitor_info') + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Visitor ID' + )->addColumn( + 'http_referer', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'HTTP Referrer' + )->addColumn( + 'http_user_agent', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'HTTP User-Agent' + )->addColumn( + 'http_accept_charset', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'HTTP Accept-Charset' + )->addColumn( + 'http_accept_language', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'HTTP Accept-Language' + )->addColumn( + 'server_addr', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + [], + 'Server Address' + )->addColumn( + 'remote_addr', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + [], + 'Remote Address' + )->setComment( + 'Log Visitor Info Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_visitor_online' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_visitor_online') + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Visitor ID' + )->addColumn( + 'visitor_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 1, + ['nullable' => false], + 'Visitor Type' + )->addColumn( + 'remote_addr', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['nullable' => false], + 'Remote Address' + )->addColumn( + 'first_visit_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'First Visit Time' + )->addColumn( + 'last_visit_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Last Visit Time' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer ID' + )->addColumn( + 'last_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Last URL' + )->addIndex( + $installer->getIdxName('log_visitor_online', ['visitor_type']), + ['visitor_type'] + )->addIndex( + $installer->getIdxName('log_visitor_online', ['first_visit_at', 'last_visit_at']), + ['first_visit_at', 'last_visit_at'] + )->addIndex( + $installer->getIdxName('log_visitor_online', ['customer_id']), + ['customer_id'] + )->setComment( + 'Log Visitor Online Table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Newsletter/Setup/InstallSchema.php b/app/code/Magento/Newsletter/Setup/InstallSchema.php new file mode 100644 index 0000000000000..b6c395e66be7a --- /dev/null +++ b/app/code/Magento/Newsletter/Setup/InstallSchema.php @@ -0,0 +1,472 @@ +startSetup(); + + /** + * Create table 'newsletter_subscriber' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_subscriber')) + ->addColumn( + 'subscriber_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Subscriber Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Store Id' + ) + ->addColumn( + 'change_status_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Change Status At' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Id' + ) + ->addColumn( + 'subscriber_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 150, + ['nullable' => true, 'default' => null], + 'Subscriber Email' + ) + ->addColumn( + 'subscriber_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Subscriber Status' + ) + ->addColumn( + 'subscriber_confirm_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['default' => 'NULL'], + 'Subscriber Confirm Code' + ) + ->addIndex( + $installer->getIdxName('newsletter_subscriber', ['customer_id']), + ['customer_id'] + ) + ->addIndex( + $installer->getIdxName('newsletter_subscriber', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('newsletter_subscriber', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Newsletter Subscriber'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'newsletter_template' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_template')) + ->addColumn( + 'template_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Template Id' + ) + ->addColumn( + 'template_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 150, + [], + 'Template Code' + ) + ->addColumn( + 'template_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Template Text' + ) + ->addColumn( + 'template_text_preprocessed', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Template Text Preprocessed' + ) + ->addColumn( + 'template_styles', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Template Styles' + ) + ->addColumn( + 'template_type', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Template Type' + ) + ->addColumn( + 'template_subject', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Template Subject' + ) + ->addColumn( + 'template_sender_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Template Sender Name' + ) + ->addColumn( + 'template_sender_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Template Sender Email' + ) + ->addColumn( + 'template_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '1'], + 'Template Actual' + ) + ->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Added At' + ) + ->addColumn( + 'modified_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Modified At' + ) + ->addIndex( + $installer->getIdxName('newsletter_template', ['template_actual']), + ['template_actual'] + ) + ->addIndex( + $installer->getIdxName('newsletter_template', ['added_at']), + ['added_at'] + ) + ->addIndex( + $installer->getIdxName('newsletter_template', ['modified_at']), + ['modified_at'] + ) + ->setComment('Newsletter Template'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'newsletter_queue' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_queue')) + ->addColumn( + 'queue_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Queue Id' + ) + ->addColumn( + 'template_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Template Id' + ) + ->addColumn( + 'newsletter_type', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Newsletter Type' + ) + ->addColumn( + 'newsletter_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Newsletter Text' + ) + ->addColumn( + 'newsletter_styles', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Newsletter Styles' + ) + ->addColumn( + 'newsletter_subject', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Newsletter Subject' + ) + ->addColumn( + 'newsletter_sender_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Newsletter Sender Name' + ) + ->addColumn( + 'newsletter_sender_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Newsletter Sender Email' + ) + ->addColumn( + 'queue_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Queue Status' + ) + ->addColumn( + 'queue_start_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Queue Start At' + ) + ->addColumn( + 'queue_finish_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Queue Finish At' + ) + ->addIndex( + $installer->getIdxName('newsletter_queue', ['template_id']), + ['template_id'] + ) + ->addForeignKey( + $installer->getFkName('newsletter_queue', 'template_id', 'newsletter_template', 'template_id'), + 'template_id', + $installer->getTable('newsletter_template'), + 'template_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Newsletter Queue'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'newsletter_queue_link' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_queue_link')) + ->addColumn( + 'queue_link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Queue Link Id' + ) + ->addColumn( + 'queue_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Queue Id' + ) + ->addColumn( + 'subscriber_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Subscriber Id' + ) + ->addColumn( + 'letter_sent_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Letter Sent At' + ) + ->addIndex( + $installer->getIdxName('newsletter_queue_link', ['subscriber_id']), + ['subscriber_id'] + ) + ->addIndex( + $installer->getIdxName('newsletter_queue_link', ['queue_id', 'letter_sent_at']), + ['queue_id', 'letter_sent_at'] + ) + ->addForeignKey( + $installer->getFkName('newsletter_queue_link', 'queue_id', 'newsletter_queue', 'queue_id'), + 'queue_id', + $installer->getTable('newsletter_queue'), + 'queue_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('newsletter_queue_link', 'subscriber_id', 'newsletter_subscriber', 'subscriber_id'), + 'subscriber_id', + $installer->getTable('newsletter_subscriber'), + 'subscriber_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Newsletter Queue Link'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'newsletter_queue_store_link' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_queue_store_link')) + ->addColumn( + 'queue_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Queue Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Store Id' + ) + ->addIndex( + $installer->getIdxName('newsletter_queue_store_link', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('newsletter_queue_store_link', 'queue_id', 'newsletter_queue', 'queue_id'), + 'queue_id', + $installer->getTable('newsletter_queue'), + 'queue_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('newsletter_queue_store_link', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Newsletter Queue Store Link'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'newsletter_problem' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_problem')) + ->addColumn( + 'problem_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Problem Id' + ) + ->addColumn( + 'subscriber_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Subscriber Id' + ) + ->addColumn( + 'queue_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Queue Id' + ) + ->addColumn( + 'problem_error_code', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Problem Error Code' + ) + ->addColumn( + 'problem_error_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Problem Error Text' + ) + ->addIndex( + $installer->getIdxName('newsletter_problem', ['subscriber_id']), + ['subscriber_id'] + ) + ->addIndex( + $installer->getIdxName('newsletter_problem', ['queue_id']), + ['queue_id'] + ) + ->addForeignKey( + $installer->getFkName('newsletter_problem', 'queue_id', 'newsletter_queue', 'queue_id'), + 'queue_id', + $installer->getTable('newsletter_queue'), + 'queue_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('newsletter_problem', 'subscriber_id', 'newsletter_subscriber', 'subscriber_id'), + 'subscriber_id', + $installer->getTable('newsletter_subscriber'), + 'subscriber_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Newsletter Problems'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/OfflineShipping/Setup/InstallSchema.php b/app/code/Magento/OfflineShipping/Setup/InstallSchema.php new file mode 100644 index 0000000000000..0928929855221 --- /dev/null +++ b/app/code/Magento/OfflineShipping/Setup/InstallSchema.php @@ -0,0 +1,142 @@ +startSetup(); + + /** + * Create table 'shipping_tablerate' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('shipping_tablerate') + )->addColumn( + 'pk', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Primary key' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Website Id' + )->addColumn( + 'dest_country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 4, + ['nullable' => false, 'default' => '0'], + 'Destination coutry ISO/2 or ISO/3 code' + )->addColumn( + 'dest_region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Destination Region Id' + )->addColumn( + 'dest_zip', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 10, + ['nullable' => false, 'default' => '*'], + 'Destination Post Code (Zip)' + )->addColumn( + 'condition_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + ['nullable' => false], + 'Rate Condition name' + )->addColumn( + 'condition_value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Rate condition value' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + )->addColumn( + 'cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Cost' + )->addIndex( + $installer->getIdxName( + 'shipping_tablerate', + ['website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->setComment( + 'Shipping Tablerate' + ); + $installer->getConnection()->createTable($table); + + $installer->getConnection()->addColumn( + $installer->getTable('salesrule'), + 'simple_free_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Simple Free Shipping' + ); + $installer->getConnection()->addColumn( + $installer->getTable('sales_order_item'), + 'free_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Free Shipping' + ); + $installer->getConnection()->addColumn( + $installer->getTable('quote_address'), + 'free_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Free Shipping' + ); + $installer->getConnection()->addColumn( + $installer->getTable('quote_item'), + 'free_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Free Shipping' + ); + $installer->getConnection()->addColumn( + $installer->getTable('quote_address_item'), + 'free_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Free Shipping' + ); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Persistent/Setup/InstallSchema.php b/app/code/Magento/Persistent/Setup/InstallSchema.php new file mode 100644 index 0000000000000..297d52c2e34e6 --- /dev/null +++ b/app/code/Magento/Persistent/Setup/InstallSchema.php @@ -0,0 +1,113 @@ +startSetup(); + + /** + * Create table 'persistent_session' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('persistent_session') + )->addColumn( + 'persistent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'primary' => true, 'nullable' => false, 'unsigned' => true], + 'Session id' + )->addColumn( + 'key', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false], + 'Unique cookie key' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer id' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website ID' + )->addColumn( + 'info', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Session Data' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addIndex( + $installer->getIdxName('persistent_session', ['key']), + ['key'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('persistent_session', ['customer_id']), + ['customer_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('persistent_session', ['updated_at']), + ['updated_at'] + )->addForeignKey( + $installer->getFkName('persistent_session', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('persistent_session', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Persistent Session' + ); + + $installer->getConnection()->createTable($table); + + /** + * Alter quote table with is_persistent flag + * + */ + $installer->getConnection()->addColumn( + $installer->getTable('quote'), + 'is_persistent', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 'unsigned' => true, + 'default' => '0', + 'comment' => 'Is Quote Persistent' + ] + ); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/ProductAlert/Setup/InstallSchema.php b/app/code/Magento/ProductAlert/Setup/InstallSchema.php new file mode 100644 index 0000000000000..05e7a826bcd39 --- /dev/null +++ b/app/code/Magento/ProductAlert/Setup/InstallSchema.php @@ -0,0 +1,210 @@ +startSetup(); + /** + * Create table 'product_alert_price' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('product_alert_price') + )->addColumn( + 'alert_price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product alert price id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product id' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price amount' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website id' + )->addColumn( + 'add_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Product alert add date' + )->addColumn( + 'last_send_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Product alert last send date' + )->addColumn( + 'send_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product alert send count' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product alert status' + )->addIndex( + $installer->getIdxName('product_alert_price', ['customer_id']), + ['customer_id'] + )->addIndex( + $installer->getIdxName('product_alert_price', ['product_id']), + ['product_id'] + )->addIndex( + $installer->getIdxName('product_alert_price', ['website_id']), + ['website_id'] + )->addForeignKey( + $installer->getFkName('product_alert_price', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('product_alert_price', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('product_alert_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Product Alert Price' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'product_alert_stock' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('product_alert_stock') + )->addColumn( + 'alert_stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product alert stock id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product id' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website id' + )->addColumn( + 'add_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Product alert add date' + )->addColumn( + 'send_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Product alert send date' + )->addColumn( + 'send_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Send Count' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product alert status' + )->addIndex( + $installer->getIdxName('product_alert_stock', ['customer_id']), + ['customer_id'] + )->addIndex( + $installer->getIdxName('product_alert_stock', ['product_id']), + ['product_id'] + )->addIndex( + $installer->getIdxName('product_alert_stock', ['website_id']), + ['website_id'] + )->addForeignKey( + $installer->getFkName('product_alert_stock', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('product_alert_stock', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('product_alert_stock', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Product Alert Stock' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Quote/Setup/InstallSchema.php b/app/code/Magento/Quote/Setup/InstallSchema.php new file mode 100644 index 0000000000000..2c65eeeaa81e6 --- /dev/null +++ b/app/code/Magento/Quote/Setup/InstallSchema.php @@ -0,0 +1,1551 @@ +startSetup(); + + /** + * Create table 'quote' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store 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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'converted_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Converted At' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '1'], + 'Is Active' + )->addColumn( + 'is_virtual', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Is Virtual' + )->addColumn( + 'is_multi_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Is Multi Shipping' + )->addColumn( + 'items_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Items Count' + )->addColumn( + 'items_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Items Qty' + )->addColumn( + 'orig_order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Orig Order Id' + )->addColumn( + 'store_to_base_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Store To Base Rate' + )->addColumn( + 'store_to_quote_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Store To Quote Rate' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Base Currency Code' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Store Currency Code' + )->addColumn( + 'quote_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Quote Currency Code' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Grand Total' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Grand Total' + )->addColumn( + 'checkout_method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Checkout Method' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Customer Id' + )->addColumn( + 'customer_tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Customer Tax Class Id' + )->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Customer Group Id' + )->addColumn( + 'customer_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Email' + )->addColumn( + 'customer_prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Customer Prefix' + )->addColumn( + 'customer_firstname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Firstname' + )->addColumn( + 'customer_middlename', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Customer Middlename' + )->addColumn( + 'customer_lastname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Lastname' + )->addColumn( + 'customer_suffix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Customer Suffix' + )->addColumn( + 'customer_dob', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Customer Dob' + )->addColumn( + 'customer_note', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Note' + )->addColumn( + 'customer_note_notify', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '1'], + 'Customer Note Notify' + )->addColumn( + 'customer_is_guest', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Customer Is Guest' + )->addColumn( + 'remote_ip', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Remote Ip' + )->addColumn( + 'applied_rule_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Applied Rule Ids' + )->addColumn( + 'reserved_order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => true], + 'Reserved Order Id' + )->addColumn( + 'password_hash', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Password Hash' + )->addColumn( + 'coupon_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Coupon Code' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Global Currency Code' + )->addColumn( + 'base_to_global_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Global Rate' + )->addColumn( + 'base_to_quote_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Quote Rate' + )->addColumn( + 'customer_taxvat', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Taxvat' + )->addColumn( + 'customer_gender', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Gender' + )->addColumn( + 'subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal' + )->addColumn( + 'base_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal' + )->addColumn( + 'subtotal_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal With Discount' + )->addColumn( + 'base_subtotal_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal With Discount' + )->addColumn( + 'is_changed', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Is Changed' + )->addColumn( + 'trigger_recollect', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Trigger Recollect' + )->addColumn( + 'ext_shipping_info', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Ext Shipping Info' + )->addIndex( + $installer->getIdxName('quote', ['customer_id', 'store_id', 'is_active']), + ['customer_id', 'store_id', 'is_active'] + )->addIndex( + $installer->getIdxName('quote', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('quote', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_address' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_address') + )->addColumn( + 'address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Address Id' + )->addColumn( + 'quote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Quote 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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer Id' + )->addColumn( + 'save_in_address_book', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['default' => '0'], + 'Save In Address Book' + )->addColumn( + 'customer_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer Address Id' + )->addColumn( + 'address_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Address Type' + )->addColumn( + 'email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Email' + )->addColumn( + 'prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Prefix' + )->addColumn( + 'firstname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Firstname' + )->addColumn( + 'middlename', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Middlename' + )->addColumn( + 'lastname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Lastname' + )->addColumn( + 'suffix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Suffix' + )->addColumn( + 'company', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Company' + )->addColumn( + 'street', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Street' + )->addColumn( + 'city', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'City' + )->addColumn( + 'region', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Region' + )->addColumn( + 'region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Region Id' + )->addColumn( + 'postcode', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Postcode' + )->addColumn( + 'country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Country Id' + )->addColumn( + 'telephone', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Phone Number' + )->addColumn( + 'fax', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Fax' + )->addColumn( + 'same_as_billing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Same As Billing' + )->addColumn( + 'collect_shipping_rates', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Collect Shipping Rates' + )->addColumn( + 'shipping_method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Method' + )->addColumn( + 'shipping_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Description' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Weight' + )->addColumn( + 'subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Subtotal' + )->addColumn( + 'base_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Subtotal' + )->addColumn( + 'subtotal_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Subtotal With Discount' + )->addColumn( + 'base_subtotal_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Subtotal With Discount' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Tax Amount' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Tax Amount' + )->addColumn( + 'shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Shipping Amount' + )->addColumn( + 'base_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Shipping Amount' + )->addColumn( + 'shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Tax Amount' + )->addColumn( + 'base_shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Tax Amount' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Discount Amount' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Grand Total' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Grand Total' + )->addColumn( + 'customer_notes', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Customer Notes' + )->addColumn( + 'applied_taxes', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Applied Taxes' + )->addColumn( + 'discount_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Discount Description' + )->addColumn( + 'shipping_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Discount Amount' + )->addColumn( + 'base_shipping_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Discount Amount' + )->addColumn( + 'subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Incl Tax' + )->addColumn( + 'base_subtotal_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Total Incl Tax' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'shipping_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Hidden Tax Amount' + )->addColumn( + 'base_shipping_hidden_tax_amnt', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Hidden Tax Amount' + )->addColumn( + 'shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Incl Tax' + )->addColumn( + 'base_shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Incl Tax' + )->addIndex( + $installer->getIdxName('quote_address', ['quote_id']), + ['quote_id'] + )->addForeignKey( + $installer->getFkName('quote_address', 'quote_id', 'quote', 'entity_id'), + 'quote_id', + $installer->getTable('quote'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Address' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_item') + )->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Item Id' + )->addColumn( + 'quote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Quote Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'parent_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Item Id' + )->addColumn( + 'is_virtual', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Virtual' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'applied_rule_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Applied Rule Ids' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'is_qty_decimal', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Qty Decimal' + )->addColumn( + 'no_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'No Discount' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Weight' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + )->addColumn( + 'base_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Price' + )->addColumn( + 'custom_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Custom Price' + )->addColumn( + 'discount_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Percent' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Discount Amount' + )->addColumn( + 'tax_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Percent' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Amount' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Tax Amount' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Row Total' + )->addColumn( + 'base_row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Row Total' + )->addColumn( + 'row_total_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Row Total With Discount' + )->addColumn( + 'row_weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Row Weight' + )->addColumn( + 'product_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Product Type' + )->addColumn( + 'base_tax_before_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Before Discount' + )->addColumn( + 'tax_before_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Before Discount' + )->addColumn( + 'original_custom_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Original Custom Price' + )->addColumn( + 'redirect_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Redirect Url' + )->addColumn( + 'base_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Cost' + )->addColumn( + 'price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price Incl Tax' + )->addColumn( + 'base_price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price Incl Tax' + )->addColumn( + 'row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total Incl Tax' + )->addColumn( + 'base_row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total Incl Tax' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addIndex( + $installer->getIdxName('quote_item', ['parent_item_id']), + ['parent_item_id'] + )->addIndex( + $installer->getIdxName('quote_item', ['product_id']), + ['product_id'] + )->addIndex( + $installer->getIdxName('quote_item', ['quote_id']), + ['quote_id'] + )->addIndex( + $installer->getIdxName('quote_item', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('quote_item', 'parent_item_id', 'quote_item', 'item_id'), + 'parent_item_id', + $installer->getTable('quote_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('quote_item', 'quote_id', 'quote', 'entity_id'), + 'quote_id', + $installer->getTable('quote'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('quote_item', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_address_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_address_item') + )->addColumn( + 'address_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Address Item Id' + )->addColumn( + 'parent_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Item Id' + )->addColumn( + 'quote_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Quote Address Id' + )->addColumn( + 'quote_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Quote Item 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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'applied_rule_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Applied Rule Ids' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Weight' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Amount' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Row Total' + )->addColumn( + 'base_row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Row Total' + )->addColumn( + 'row_total_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Row Total With Discount' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Discount Amount' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Tax Amount' + )->addColumn( + 'row_weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Row Weight' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'super_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Super Product Id' + )->addColumn( + 'parent_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Product Id' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addColumn( + 'image', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Image' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'is_qty_decimal', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Is Qty Decimal' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + )->addColumn( + 'discount_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Percent' + )->addColumn( + 'no_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'No Discount' + )->addColumn( + 'tax_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Percent' + )->addColumn( + 'base_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price' + )->addColumn( + 'base_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Cost' + )->addColumn( + 'price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price Incl Tax' + )->addColumn( + 'base_price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price Incl Tax' + )->addColumn( + 'row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total Incl Tax' + )->addColumn( + 'base_row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total Incl Tax' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addIndex( + $installer->getIdxName('quote_address_item', ['quote_address_id']), + ['quote_address_id'] + )->addIndex( + $installer->getIdxName('quote_address_item', ['parent_item_id']), + ['parent_item_id'] + )->addIndex( + $installer->getIdxName('quote_address_item', ['quote_item_id']), + ['quote_item_id'] + )->addForeignKey( + $installer->getFkName( + 'quote_address_item', + 'quote_address_id', + 'quote_address', + 'address_id' + ), + 'quote_address_id', + $installer->getTable('quote_address'), + 'address_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName( + 'quote_address_item', + 'parent_item_id', + 'quote_address_item', + 'address_item_id' + ), + 'parent_item_id', + $installer->getTable('quote_address_item'), + 'address_item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('quote_address_item', 'quote_item_id', 'quote_item', 'item_id'), + 'quote_item_id', + $installer->getTable('quote_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Address Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_item_option' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_item_option') + )->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Id' + )->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Item Id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Product Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Code' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Value' + )->addIndex( + $installer->getIdxName('quote_item_option', ['item_id']), + ['item_id'] + )->addForeignKey( + $installer->getFkName('quote_item_option', 'item_id', 'quote_item', 'item_id'), + 'item_id', + $installer->getTable('quote_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Item Option' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_payment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_payment') + )->addColumn( + 'payment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Payment Id' + )->addColumn( + 'quote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Quote 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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Method' + )->addColumn( + 'cc_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Type' + )->addColumn( + 'cc_number_enc', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Number Enc' + )->addColumn( + 'cc_last_4', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Last 4' + )->addColumn( + 'cc_cid_enc', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Cid Enc' + )->addColumn( + 'cc_owner', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Owner' + )->addColumn( + 'cc_exp_month', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['unsigned' => true, 'default' => null, 'nullable' => true], + 'Cc Exp Month' + )->addColumn( + 'cc_exp_year', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Cc Exp Year' + )->addColumn( + 'cc_ss_owner', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Ss Owner' + )->addColumn( + 'cc_ss_start_month', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Cc Ss Start Month' + )->addColumn( + 'cc_ss_start_year', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Cc Ss Start Year' + )->addColumn( + 'po_number', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Po Number' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'cc_ss_issue', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Ss Issue' + )->addColumn( + 'additional_information', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Information' + )->addIndex( + $installer->getIdxName('quote_payment', ['quote_id']), + ['quote_id'] + )->addForeignKey( + $installer->getFkName('quote_payment', 'quote_id', 'quote', 'entity_id'), + 'quote_id', + $installer->getTable('quote'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Payment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_shipping_rate' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_shipping_rate') + )->addColumn( + 'rate_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rate Id' + )->addColumn( + 'address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Address 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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'carrier', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Carrier' + )->addColumn( + 'carrier_title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Carrier Title' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Code' + )->addColumn( + 'method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Method' + )->addColumn( + 'method_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Method Description' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + )->addColumn( + 'error_message', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Error Message' + )->addColumn( + 'method_title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Method Title' + )->addIndex( + $installer->getIdxName('quote_shipping_rate', ['address_id']), + ['address_id'] + )->addForeignKey( + $installer->getFkName('quote_shipping_rate', 'address_id', 'quote_address', 'address_id'), + 'address_id', + $installer->getTable('quote_address'), + 'address_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Shipping Rate' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Reports/Setup/InstallSchema.php b/app/code/Magento/Reports/Setup/InstallSchema.php new file mode 100644 index 0000000000000..16f4c0b5d9f56 --- /dev/null +++ b/app/code/Magento/Reports/Setup/InstallSchema.php @@ -0,0 +1,872 @@ +startSetup(); + + /** + * Create table 'report_compared_product_index'. + * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that + * only one record is added when customer/visitor compares same product again. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_compared_product_index')) + ->addColumn( + 'index_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Index Id' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Visitor Id' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer 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], + 'Store Id' + ) + ->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Added At' + ) + ->addIndex( + $installer->getIdxName( + 'report_compared_product_index', + ['visitor_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['visitor_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName( + 'report_compared_product_index', + ['customer_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['customer_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['added_at']), + ['added_at'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Reports Compared Product Index Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_viewed_product_index' + * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that + * only one record is added when customer/visitor views same product again. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_viewed_product_index')) + ->addColumn( + 'index_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Index Id' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Visitor Id' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer 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], + 'Store Id' + ) + ->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Added At' + ) + ->addIndex( + $installer->getIdxName( + 'report_viewed_product_index', + ['visitor_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['visitor_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName( + 'report_viewed_product_index', + ['customer_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['customer_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['added_at']), + ['added_at'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Reports Viewed Product Index Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_event_types' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_event_types')) + ->addColumn( + 'event_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Event Type Id' + ) + ->addColumn( + 'event_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => false], + 'Event Name' + ) + ->addColumn( + 'customer_login', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Login' + ) + ->setComment('Reports Event Type Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_event' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_event')) + ->addColumn( + 'event_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Event Id' + ) + ->addColumn( + 'logged_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Logged At' + ) + ->addColumn( + 'event_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Event Type Id' + ) + ->addColumn( + 'object_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Object Id' + ) + ->addColumn( + 'subject_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Subject Id' + ) + ->addColumn( + 'subtype', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Subtype' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + ) + ->addIndex( + $installer->getIdxName('report_event', ['event_type_id']), + ['event_type_id'] + ) + ->addIndex( + $installer->getIdxName('report_event', ['subject_id']), + ['subject_id'] + ) + ->addIndex( + $installer->getIdxName('report_event', ['object_id']), + ['object_id'] + ) + ->addIndex( + $installer->getIdxName('report_event', ['subtype']), + ['subtype'] + ) + ->addIndex( + $installer->getIdxName('report_event', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('report_event', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_event', 'event_type_id', 'report_event_types', 'event_type_id'), + 'event_type_id', + $installer->getTable('report_event_types'), + 'event_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Reports Event Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_compared_product_index'. + * MySQL table differs by having unique keys on (customer/visitor, product) columns and is created + * in separate install. + */ + $tableName = $installer->getTable('report_compared_product_index'); + if (!$installer->tableExists($tableName)) { + $table = $installer->getConnection() + ->newTable($tableName) + ->addColumn( + 'index_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Index Id' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Visitor Id' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer 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], + 'Store Id' + ) + ->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Added At' + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['visitor_id', 'product_id']), + ['visitor_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['customer_id', 'product_id']), + ['customer_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['added_at']), + ['added_at'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Reports Compared Product Index Table'); + $installer->getConnection()->createTable($table); + } + + /** + * Create table 'report_viewed_product_index'. + * MySQL table differs by having unique keys on (customer/visitor, product) columns and is created + * in separate install. + */ + $tableName = $installer->getTable('report_viewed_product_index'); + if (!$installer->tableExists($tableName)) { + $table = $installer->getConnection() + ->newTable($tableName) + ->addColumn( + 'index_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Index Id' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Visitor Id' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer 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], + 'Store Id' + ) + ->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Added At' + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['visitor_id', 'product_id']), + ['visitor_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['customer_id', 'product_id']), + ['customer_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['added_at']), + ['added_at'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Reports Viewed Product Index Table'); + $installer->getConnection()->createTable($table); + } + + /** + * Create table 'report_viewed_product_aggregated_daily'. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_viewed_product_aggregated_daily')) + ->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + ) + ->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + ) + ->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + ) + ->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + ) + ->addColumn( + 'views_num', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Number of Views' + ) + ->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + ) + ->addIndex( + $installer->getIdxName( + 'report_viewed_product_aggregated_daily', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_daily', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_daily', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_aggregated_daily', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'report_viewed_product_aggregated_daily', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Most Viewed Products Aggregated Daily'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_viewed_product_aggregated_monthly'. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_viewed_product_aggregated_monthly')) + ->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + ) + ->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + ) + ->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + ) + ->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + ) + ->addColumn( + 'views_num', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Number of Views' + ) + ->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + ) + ->addIndex( + $installer->getIdxName( + 'report_viewed_product_aggregated_monthly', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_monthly', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_monthly', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_aggregated_monthly', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'report_viewed_product_aggregated_monthly', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Most Viewed Products Aggregated Monthly'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_viewed_product_aggregated_yearly'. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_viewed_product_aggregated_yearly')) + ->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + ) + ->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + ) + ->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + ) + ->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + ) + ->addColumn( + 'views_num', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Number of Views' + ) + ->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + ) + ->addIndex( + $installer->getIdxName( + 'report_viewed_product_aggregated_yearly', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_yearly', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_yearly', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_aggregated_yearly', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'report_viewed_product_aggregated_yearly', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Most Viewed Products Aggregated Yearly'); + $installer->getConnection()->createTable($table); + + /* + * Prepare database for tables install + */ + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Review/Setup/InstallData.php b/app/code/Magento/Review/Setup/InstallData.php new file mode 100755 index 0000000000000..35b635ee14de9 --- /dev/null +++ b/app/code/Magento/Review/Setup/InstallData.php @@ -0,0 +1,76 @@ +getConnection()->insert($installer->getTable('review_entity'), ['entity_code' => $entityCode]); + } + + //Fill table review/review_entity + $reviewStatuses = [ + \Magento\Review\Model\Review::STATUS_APPROVED => 'Approved', + \Magento\Review\Model\Review::STATUS_PENDING => 'Pending', + \Magento\Review\Model\Review::STATUS_NOT_APPROVED => 'Not Approved', + ]; + foreach ($reviewStatuses as $k => $v) { + $bind = ['status_id' => $k, 'status_code' => $v]; + $installer->getConnection()->insertForce($installer->getTable('review_status'), $bind); + } + + $data = [ + \Magento\Review\Model\Rating::ENTITY_PRODUCT_CODE => [ + ['rating_code' => 'Quality', 'position' => 0], + ['rating_code' => 'Value', 'position' => 0], + ['rating_code' => 'Price', 'position' => 0], + ], + \Magento\Review\Model\Rating::ENTITY_PRODUCT_REVIEW_CODE => [], + \Magento\Review\Model\Rating::ENTITY_REVIEW_CODE => [], + ]; + + foreach ($data as $entityCode => $ratings) { + //Fill table rating/rating_entity + $installer->getConnection()->insert($installer->getTable('rating_entity'), ['entity_code' => $entityCode]); + $entityId = $installer->getConnection()->lastInsertId($installer->getTable('rating_entity')); + + foreach ($ratings as $bind) { + //Fill table rating/rating + $bind['entity_id'] = $entityId; + $installer->getConnection()->insert($installer->getTable('rating'), $bind); + + //Fill table rating/rating_option + $ratingId = $installer->getConnection()->lastInsertId($installer->getTable('rating')); + $optionData = []; + for ($i = 1; $i <= 5; $i++) { + $optionData[] = ['rating_id' => $ratingId, 'code' => (string)$i, 'value' => $i, 'position' => $i]; + } + $installer->getConnection()->insertMultiple($installer->getTable('rating_option'), $optionData); + } + } + + } +} \ No newline at end of file diff --git a/app/code/Magento/Review/Setup/InstallSchema.php b/app/code/Magento/Review/Setup/InstallSchema.php new file mode 100644 index 0000000000000..1e34e71c1edab --- /dev/null +++ b/app/code/Magento/Review/Setup/InstallSchema.php @@ -0,0 +1,767 @@ +startSetup(); + /** + * Create table 'review_entity' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review_entity')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Review entity id' + ) + ->addColumn( + 'entity_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Review entity code' + ) + ->setComment('Review entities'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'review_status' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review_status')) + ->addColumn( + 'status_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Status id' + ) + ->addColumn( + 'status_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Status code' + ) + ->setComment('Review statuses'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'review' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review')) + ->addColumn( + 'review_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Review id' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Review create date' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity id' + ) + ->addColumn( + 'entity_pk_value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product id' + ) + ->addColumn( + 'status_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Status code' + ) + ->addIndex( + $installer->getIdxName('review', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('review', ['status_id']), + ['status_id'] + ) + ->addIndex( + $installer->getIdxName('review', ['entity_pk_value']), + ['entity_pk_value'] + ) + ->addForeignKey( + $installer->getFkName('review', 'entity_id', 'review_entity', 'entity_id'), + 'entity_id', + $installer->getTable('review_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('review', 'status_id', 'review_status', 'status_id'), + 'status_id', + $installer->getTable('review_status'), + 'status_id', + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + ) + ->setComment('Review base information'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'review_detail' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review_detail')) + ->addColumn( + 'detail_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Review detail id' + ) + ->addColumn( + 'review_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Review id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Store id' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Title' + ) + ->addColumn( + 'detail', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Detail description' + ) + ->addColumn( + 'nickname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 128, + ['nullable' => false], + 'User nickname' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer Id' + ) + ->addIndex( + $installer->getIdxName('review_detail', ['review_id']), + ['review_id'] + ) + ->addIndex( + $installer->getIdxName('review_detail', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('review_detail', ['customer_id']), + ['customer_id'] + ) + ->addForeignKey( + $installer->getFkName('review_detail', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('review_detail', 'review_id', 'review', 'review_id'), + 'review_id', + $installer->getTable('review'), + 'review_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('review_detail', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Review detail information'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'review_entity_summary' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review_entity_summary')) + ->addColumn( + 'primary_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Summary review entity id' + ) + ->addColumn( + 'entity_pk_value', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['nullable' => false, 'default' => '0'], + 'Product id' + ) + ->addColumn( + 'entity_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Entity type id' + ) + ->addColumn( + 'reviews_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Qty of reviews' + ) + ->addColumn( + 'rating_summary', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Summarized rating' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store id' + ) + ->addIndex( + $installer->getIdxName('review_entity_summary', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('review_entity_summary', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Review aggregates'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'review_store' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review_store')) + ->addColumn( + 'review_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Review Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store Id' + ) + ->addIndex( + $installer->getIdxName('review_store', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('review_store', 'review_id', 'review', 'review_id'), + 'review_id', + $installer->getTable('review'), + 'review_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('review_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Review Store'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_entity' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_entity')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'entity_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => false], + 'Entity Code' + ) + ->addIndex( + $installer->getIdxName( + 'rating_entity', + ['entity_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->setComment('Rating entities'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating')) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rating Id' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Entity Id' + ) + ->addColumn( + 'rating_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => false], + 'Rating Code' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Rating Position On Frontend' + ) + ->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 1], + 'Rating is active.' + ) + ->addIndex( + $installer->getIdxName( + 'rating', + ['rating_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['rating_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('rating', ['entity_id']), + ['entity_id'] + ) + ->addForeignKey( + $installer->getFkName('rating', 'entity_id', 'rating_entity', 'entity_id'), + 'entity_id', + $installer->getTable('rating_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Ratings'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_option' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_option')) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rating Option Id' + ) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Rating Id' + ) + ->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Rating Option Code' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Rating Option Value' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Ration option position on frontend' + ) + ->addIndex( + $installer->getIdxName('rating_option', ['rating_id']), + ['rating_id'] + ) + ->addForeignKey( + $installer->getFkName('rating_option', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Rating options'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_option_vote' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_option_vote')) + ->addColumn( + 'vote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Vote id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Vote option id' + ) + ->addColumn( + 'remote_ip', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['nullable' => false], + 'Customer IP' + ) + ->addColumn( + 'remote_ip_long', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['nullable' => false, 'default' => 0], + 'Customer IP converted to long integer format' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => 0], + 'Customer Id' + ) + ->addColumn( + 'entity_pk_value', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Product id' + ) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Rating id' + ) + ->addColumn( + 'review_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true], + 'Review id' + ) + ->addColumn( + 'percent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0], + 'Percent amount' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0], + 'Vote option value' + ) + ->addIndex( + $installer->getIdxName('rating_option_vote', ['option_id']), + ['option_id'] + ) + ->addForeignKey( + $installer->getFkName('rating_option_vote', 'option_id', 'rating_option', 'option_id'), + 'option_id', + $installer->getTable('rating_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('rating_option_vote', 'review_id', 'review', 'review_id'), + 'review_id', + $installer->getTable('review'), + 'review_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Rating option values'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_option_vote_aggregated' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_option_vote_aggregated')) + ->addColumn( + 'primary_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Vote aggregation id' + ) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Rating id' + ) + ->addColumn( + 'entity_pk_value', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Product id' + ) + ->addColumn( + 'vote_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Vote dty' + ) + ->addColumn( + 'vote_value_sum', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'General vote sum' + ) + ->addColumn( + 'percent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0], + 'Vote percent' + ) + ->addColumn( + 'percent_approved', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['default' => '0'], + 'Vote percent approved by admin' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Store Id' + ) + ->addIndex( + $installer->getIdxName('rating_option_vote_aggregated', ['rating_id']), + ['rating_id'] + ) + ->addIndex( + $installer->getIdxName('rating_option_vote_aggregated', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('rating_option_vote_aggregated', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('rating_option_vote_aggregated', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Rating vote aggregated'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_store' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_store')) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], + 'Rating id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], + 'Store id' + ) + ->addIndex( + $installer->getIdxName('rating_store', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('rating_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('rating_store', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + ) + ->setComment('Rating Store'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_title' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_title')) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], + 'Rating Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], + 'Store Id' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Rating Label' + ) + ->addIndex( + $installer->getIdxName('rating_title', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('rating_title', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('rating_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Rating Title'); + $installer->getConnection()->createTable($table); + + $setup->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Sales/Setup/InstallSchema.php b/app/code/Magento/Sales/Setup/InstallSchema.php new file mode 100644 index 0000000000000..5a54af0f3b992 --- /dev/null +++ b/app/code/Magento/Sales/Setup/InstallSchema.php @@ -0,0 +1,5174 @@ +startSetup(); + + /** + * Create table 'sales_order' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'State' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Status' + )->addColumn( + 'coupon_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Coupon Code' + )->addColumn( + 'protect_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Protect Code' + )->addColumn( + 'shipping_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Description' + )->addColumn( + 'is_virtual', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Virtual' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer Id' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Amount' + )->addColumn( + 'base_discount_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Canceled' + )->addColumn( + 'base_discount_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Invoiced' + )->addColumn( + 'base_discount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Refunded' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'base_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Amount' + )->addColumn( + 'base_shipping_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Canceled' + )->addColumn( + 'base_shipping_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Invoiced' + )->addColumn( + 'base_shipping_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Refunded' + )->addColumn( + 'base_shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Tax Amount' + )->addColumn( + 'base_shipping_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Tax Refunded' + )->addColumn( + 'base_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal' + )->addColumn( + 'base_subtotal_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Canceled' + )->addColumn( + 'base_subtotal_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Invoiced' + )->addColumn( + 'base_subtotal_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Refunded' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Amount' + )->addColumn( + 'base_tax_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Canceled' + )->addColumn( + 'base_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Invoiced' + )->addColumn( + 'base_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Refunded' + )->addColumn( + 'base_to_global_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Global Rate' + )->addColumn( + 'base_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Order Rate' + )->addColumn( + 'base_total_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Canceled' + )->addColumn( + 'base_total_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Invoiced' + )->addColumn( + 'base_total_invoiced_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Invoiced Cost' + )->addColumn( + 'base_total_offline_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Offline Refunded' + )->addColumn( + 'base_total_online_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Online Refunded' + )->addColumn( + 'base_total_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Paid' + )->addColumn( + 'base_total_qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Qty Ordered' + )->addColumn( + 'base_total_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Refunded' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Amount' + )->addColumn( + 'discount_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Canceled' + )->addColumn( + 'discount_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Invoiced' + )->addColumn( + 'discount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Refunded' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Amount' + )->addColumn( + 'shipping_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Canceled' + )->addColumn( + 'shipping_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Invoiced' + )->addColumn( + 'shipping_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Refunded' + )->addColumn( + 'shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Tax Amount' + )->addColumn( + 'shipping_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Tax Refunded' + )->addColumn( + 'store_to_base_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Base Rate' + )->addColumn( + 'store_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Order Rate' + )->addColumn( + 'subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal' + )->addColumn( + 'subtotal_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Canceled' + )->addColumn( + 'subtotal_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Invoiced' + )->addColumn( + 'subtotal_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Refunded' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Amount' + )->addColumn( + 'tax_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Canceled' + )->addColumn( + 'tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Invoiced' + )->addColumn( + 'tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Refunded' + )->addColumn( + 'total_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Canceled' + )->addColumn( + 'total_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Invoiced' + )->addColumn( + 'total_offline_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Offline Refunded' + )->addColumn( + 'total_online_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Online Refunded' + )->addColumn( + 'total_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Paid' + )->addColumn( + 'total_qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Qty Ordered' + )->addColumn( + 'total_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Refunded' + )->addColumn( + 'can_ship_partially', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Can Ship Partially' + )->addColumn( + 'can_ship_partially_item', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Can Ship Partially Item' + )->addColumn( + 'customer_is_guest', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Customer Is Guest' + )->addColumn( + 'customer_note_notify', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Customer Note Notify' + )->addColumn( + 'billing_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Billing Address Id' + )->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + [], + 'Customer Group Id' + )->addColumn( + 'edit_increment', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Edit Increment' + )->addColumn( + 'email_sent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Email Sent' + )->addColumn( + 'forced_shipment_with_invoice', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Forced Do Shipment With Invoice' + )->addColumn( + 'payment_auth_expiration', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Payment Authorization Expiration' + )->addColumn( + 'quote_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Quote Address Id' + )->addColumn( + 'quote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Quote Id' + )->addColumn( + 'shipping_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipping Address Id' + )->addColumn( + 'adjustment_negative', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Adjustment Negative' + )->addColumn( + 'adjustment_positive', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Adjustment Positive' + )->addColumn( + 'base_adjustment_negative', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Adjustment Negative' + )->addColumn( + 'base_adjustment_positive', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Adjustment Positive' + )->addColumn( + 'base_shipping_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Discount Amount' + )->addColumn( + 'base_subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Incl Tax' + )->addColumn( + 'base_total_due', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Due' + )->addColumn( + 'payment_authorization_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Payment Authorization Amount' + )->addColumn( + 'shipping_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Discount Amount' + )->addColumn( + 'subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Incl Tax' + )->addColumn( + 'total_due', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Due' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Weight' + )->addColumn( + 'customer_dob', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Customer Dob' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'applied_rule_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Applied Rule Ids' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'customer_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Email' + )->addColumn( + 'customer_firstname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Firstname' + )->addColumn( + 'customer_lastname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Lastname' + )->addColumn( + 'customer_middlename', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Middlename' + )->addColumn( + 'customer_prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Prefix' + )->addColumn( + 'customer_suffix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Suffix' + )->addColumn( + 'customer_taxvat', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Taxvat' + )->addColumn( + 'discount_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Discount Description' + )->addColumn( + 'ext_customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Ext Customer Id' + )->addColumn( + 'ext_order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Ext Order Id' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Global Currency Code' + )->addColumn( + 'hold_before_state', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Hold Before State' + )->addColumn( + 'hold_before_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Hold Before Status' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Order Currency Code' + )->addColumn( + 'original_increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Original Increment Id' + )->addColumn( + 'relation_child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Relation Child Id' + )->addColumn( + 'relation_child_real_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Relation Child Real Id' + )->addColumn( + 'relation_parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Relation Parent Id' + )->addColumn( + 'relation_parent_real_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Relation Parent Real Id' + )->addColumn( + 'remote_ip', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Remote Ip' + )->addColumn( + 'shipping_method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Method' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Store Currency Code' + )->addColumn( + 'store_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Store Name' + )->addColumn( + 'x_forwarded_for', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'X Forwarded For' + )->addColumn( + 'customer_note', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Customer Note' + )->addColumn( + '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_UPDATE], + 'Updated At' + )->addColumn( + 'total_item_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Total Item Count' + )->addColumn( + 'customer_gender', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Customer Gender' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'shipping_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Hidden Tax Amount' + )->addColumn( + 'base_shipping_hidden_tax_amnt', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Hidden Tax Amount' + )->addColumn( + 'hidden_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Invoiced' + )->addColumn( + 'base_hidden_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Invoiced' + )->addColumn( + 'hidden_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Refunded' + )->addColumn( + 'base_hidden_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Refunded' + )->addColumn( + 'shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Incl Tax' + )->addColumn( + 'base_shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Incl Tax' + )->addColumn( + 'coupon_rule_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Coupon Sales Rule Name' + )->addIndex( + $installer->getIdxName('sales_order', ['status']), + ['status'] + )->addIndex( + $installer->getIdxName('sales_order', ['state']), + ['state'] + )->addIndex( + $installer->getIdxName('sales_order', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName( + 'sales_order', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_order', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_order', ['customer_id']), + ['customer_id'] + )->addIndex( + $installer->getIdxName('sales_order', ['ext_order_id']), + ['ext_order_id'] + )->addIndex( + $installer->getIdxName('sales_order', ['quote_id']), + ['quote_id'] + )->addIndex( + $installer->getIdxName('sales_order', ['updated_at']), + ['updated_at'] + )->addForeignKey( + $installer->getFkName('sales_order', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_order', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_grid' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_grid') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Status' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'store_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Store Name' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer Id' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'base_total_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Paid' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'total_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Paid' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Order Currency Code' + )->addColumn( + 'shipping_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Name' + )->addColumn( + 'billing_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Billing Name' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addIndex( + $installer->getIdxName('sales_order_grid', ['status']), + ['status'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['base_grand_total']), + ['base_grand_total'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['base_total_paid']), + ['base_total_paid'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['grand_total']), + ['grand_total'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['total_paid']), + ['total_paid'] + )->addIndex( + $installer->getIdxName( + 'sales_order_grid', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['shipping_name']), + ['shipping_name'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['billing_name']), + ['billing_name'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['customer_id']), + ['customer_id'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['updated_at']), + ['updated_at'] + )->addForeignKey( + $installer->getFkName('sales_order_grid', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_order_grid', 'entity_id', 'sales_order', 'entity_id'), + 'entity_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_order_grid', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order Grid' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_address' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_address') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Id' + )->addColumn( + 'customer_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Customer Address Id' + )->addColumn( + 'quote_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Quote Address Id' + )->addColumn( + 'region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Region Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Customer Id' + )->addColumn( + 'fax', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Fax' + )->addColumn( + 'region', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Region' + )->addColumn( + 'postcode', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Postcode' + )->addColumn( + 'lastname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Lastname' + )->addColumn( + 'street', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Street' + )->addColumn( + 'city', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'City' + )->addColumn( + 'email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Email' + )->addColumn( + 'telephone', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Phone Number' + )->addColumn( + 'country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + [], + 'Country Id' + )->addColumn( + 'firstname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Firstname' + )->addColumn( + 'address_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Address Type' + )->addColumn( + 'prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Prefix' + )->addColumn( + 'middlename', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Middlename' + )->addColumn( + 'suffix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Suffix' + )->addColumn( + 'company', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Company' + )->addIndex( + $installer->getIdxName('sales_order_address', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_order_address', 'parent_id', 'sales_order', 'entity_id'), + 'parent_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order Address' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_status_history' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status_history') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'is_customer_notified', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Is Customer Notified' + )->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + )->addColumn( + 'comment', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Comment' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Status' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'entity_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true], + 'Shows what entity history is bind to.' + )->addIndex( + $installer->getIdxName('sales_order_status_history', ['parent_id']), + ['parent_id'] + )->addIndex( + $installer->getIdxName('sales_order_status_history', ['created_at']), + ['created_at'] + )->addForeignKey( + $installer->getFkName('sales_order_status_history', 'parent_id', 'sales_order', 'entity_id'), + 'parent_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order Status History' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_item') + )->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Item Id' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Order Id' + )->addColumn( + 'parent_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Item Id' + )->addColumn( + 'quote_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Quote Item Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Updated At' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'product_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Product Type' + )->addColumn( + 'product_options', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Product Options' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Weight' + )->addColumn( + 'is_virtual', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Virtual' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'applied_rule_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Applied Rule Ids' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'is_qty_decimal', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Qty Decimal' + )->addColumn( + 'no_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'No Discount' + )->addColumn( + 'qty_backordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Backordered' + )->addColumn( + 'qty_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Canceled' + )->addColumn( + 'qty_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Invoiced' + )->addColumn( + 'qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Ordered' + )->addColumn( + 'qty_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Refunded' + )->addColumn( + 'qty_shipped', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Shipped' + )->addColumn( + 'base_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Cost' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + )->addColumn( + 'base_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Price' + )->addColumn( + 'original_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Original Price' + )->addColumn( + 'base_original_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Original Price' + )->addColumn( + 'tax_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Percent' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Amount' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Tax Amount' + )->addColumn( + 'tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Invoiced' + )->addColumn( + 'base_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Tax Invoiced' + )->addColumn( + 'discount_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Percent' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Discount Amount' + )->addColumn( + 'discount_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Invoiced' + )->addColumn( + 'base_discount_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Discount Invoiced' + )->addColumn( + 'amount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Amount Refunded' + )->addColumn( + 'base_amount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Amount Refunded' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Row Total' + )->addColumn( + 'base_row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Row Total' + )->addColumn( + 'row_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Row Invoiced' + )->addColumn( + 'base_row_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Row Invoiced' + )->addColumn( + 'row_weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Row Weight' + )->addColumn( + 'base_tax_before_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Before Discount' + )->addColumn( + 'tax_before_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Before Discount' + )->addColumn( + 'ext_order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Ext Order Item Id' + )->addColumn( + 'locked_do_invoice', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Locked Do Invoice' + )->addColumn( + 'locked_do_ship', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Locked Do Ship' + )->addColumn( + 'price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price Incl Tax' + )->addColumn( + 'base_price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price Incl Tax' + )->addColumn( + 'row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total Incl Tax' + )->addColumn( + 'base_row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total Incl Tax' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'hidden_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Invoiced' + )->addColumn( + 'base_hidden_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Invoiced' + )->addColumn( + 'hidden_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Refunded' + )->addColumn( + 'base_hidden_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Refunded' + )->addColumn( + 'tax_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Canceled' + )->addColumn( + 'hidden_tax_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Canceled' + )->addColumn( + 'tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Refunded' + )->addColumn( + 'base_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Refunded' + )->addColumn( + 'discount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Refunded' + )->addColumn( + 'base_discount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Refunded' + )->addIndex( + $installer->getIdxName('sales_order_item', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_order_item', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_order_item', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_order_item', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_payment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_payment') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'base_shipping_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Captured' + )->addColumn( + 'shipping_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Captured' + )->addColumn( + 'amount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount Refunded' + )->addColumn( + 'base_amount_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Paid' + )->addColumn( + 'amount_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount Canceled' + )->addColumn( + 'base_amount_authorized', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Authorized' + )->addColumn( + 'base_amount_paid_online', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Paid Online' + )->addColumn( + 'base_amount_refunded_online', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Refunded Online' + )->addColumn( + 'base_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Amount' + )->addColumn( + 'shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Amount' + )->addColumn( + 'amount_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount Paid' + )->addColumn( + 'amount_authorized', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount Authorized' + )->addColumn( + 'base_amount_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Ordered' + )->addColumn( + 'base_shipping_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Refunded' + )->addColumn( + 'shipping_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Refunded' + )->addColumn( + 'base_amount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Refunded' + )->addColumn( + 'amount_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount Ordered' + )->addColumn( + 'base_amount_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Canceled' + )->addColumn( + 'quote_payment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Quote Payment Id' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'cc_exp_month', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Exp Month' + )->addColumn( + 'cc_ss_start_year', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Ss Start Year' + )->addColumn( + 'echeck_bank_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Echeck Bank Name' + )->addColumn( + 'method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Method' + )->addColumn( + 'cc_debug_request_body', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Debug Request Body' + )->addColumn( + 'cc_secure_verify', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Secure Verify' + )->addColumn( + 'protection_eligibility', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Protection Eligibility' + )->addColumn( + 'cc_approval', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Approval' + )->addColumn( + 'cc_last_4', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Last 4' + )->addColumn( + 'cc_status_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Status Description' + )->addColumn( + 'echeck_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Echeck Type' + )->addColumn( + 'cc_debug_response_serialized', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Debug Response Serialized' + )->addColumn( + 'cc_ss_start_month', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Ss Start Month' + )->addColumn( + 'echeck_account_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Echeck Account Type' + )->addColumn( + 'last_trans_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Last Trans Id' + )->addColumn( + 'cc_cid_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Cid Status' + )->addColumn( + 'cc_owner', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Owner' + )->addColumn( + 'cc_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Type' + )->addColumn( + 'po_number', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Po Number' + )->addColumn( + 'cc_exp_year', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Cc Exp Year' + )->addColumn( + 'cc_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Status' + )->addColumn( + 'echeck_routing_number', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Echeck Routing Number' + )->addColumn( + 'account_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Account Status' + )->addColumn( + 'anet_trans_method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Anet Trans Method' + )->addColumn( + 'cc_debug_response_body', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Debug Response Body' + )->addColumn( + 'cc_ss_issue', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Ss Issue' + )->addColumn( + 'echeck_account_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Echeck Account Name' + )->addColumn( + 'cc_avs_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Avs Status' + )->addColumn( + 'cc_number_enc', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Number Enc' + )->addColumn( + 'cc_trans_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Trans Id' + )->addColumn( + 'address_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Address Status' + )->addColumn( + 'additional_information', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Information' + )->addIndex( + $installer->getIdxName('sales_order_payment', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_order_payment', 'parent_id', 'sales_order', 'entity_id'), + 'parent_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order Payment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'total_weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Weight' + )->addColumn( + 'total_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Qty' + )->addColumn( + 'email_sent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Email Sent' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Customer Id' + )->addColumn( + 'shipping_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipping Address Id' + )->addColumn( + 'billing_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Billing Address Id' + )->addColumn( + 'shipment_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipment Status' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addColumn( + 'packages', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '20000', + [], + 'Packed Products in Packages' + )->addColumn( + 'shipping_label', + \Magento\Framework\DB\Ddl\Table::TYPE_VARBINARY, + '2m', + [], + 'Shipping Label Content' + )->addIndex( + $installer->getIdxName('sales_shipment', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_shipment', ['total_qty']), + ['total_qty'] + )->addIndex( + $installer->getIdxName( + 'sales_shipment', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_shipment', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_shipment', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_shipment', ['updated_at']), + ['updated_at'] + )->addForeignKey( + $installer->getFkName('sales_shipment', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_shipment', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Shipment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipment_grid' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_grid') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'total_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Qty' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'shipment_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipment Status' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'order_increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'order_created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Order Created At' + )->addColumn( + 'shipping_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Name' + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['total_qty']), + ['total_qty'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['shipment_status']), + ['shipment_status'] + )->addIndex( + $installer->getIdxName( + 'sales_shipment_grid', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['order_increment_id']), + ['order_increment_id'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['order_created_at']), + ['order_created_at'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['shipping_name']), + ['shipping_name'] + )->addForeignKey( + $installer->getFkName('sales_shipment_grid', 'entity_id', 'sales_shipment', 'entity_id'), + 'entity_id', + $installer->getTable('sales_shipment'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_shipment_grid', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Shipment Grid' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipment_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_item') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Weight' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Qty' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Product Id' + )->addColumn( + 'order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Order Item Id' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addIndex( + $installer->getIdxName('sales_shipment_item', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_shipment_item', 'parent_id', 'sales_shipment', 'entity_id'), + 'parent_id', + $installer->getTable('sales_shipment'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Shipment Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipment_track' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_track') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Weight' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Qty' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'track_number', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Number' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Title' + )->addColumn( + 'carrier_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Carrier Code' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addIndex( + $installer->getIdxName('sales_shipment_track', ['parent_id']), + ['parent_id'] + )->addIndex( + $installer->getIdxName('sales_shipment_track', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_shipment_track', ['created_at']), + ['created_at'] + )->addForeignKey( + $installer->getFkName('sales_shipment_track', 'parent_id', 'sales_shipment', 'entity_id'), + 'parent_id', + $installer->getTable('sales_shipment'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Shipment Track' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipment_comment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_comment') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'is_customer_notified', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Is Customer Notified' + )->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + )->addColumn( + 'comment', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Comment' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addIndex( + $installer->getIdxName('sales_shipment_comment', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_shipment_comment', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_shipment_comment', 'parent_id', 'sales_shipment', 'entity_id'), + 'parent_id', + $installer->getTable('sales_shipment'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Shipment Comment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoice' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'identity' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Tax Amount' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Amount' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Amount' + )->addColumn( + 'store_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Order Rate' + )->addColumn( + 'base_shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Tax Amount' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Amount' + )->addColumn( + 'base_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Order Rate' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Amount' + )->addColumn( + 'subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Incl Tax' + )->addColumn( + 'base_subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Incl Tax' + )->addColumn( + 'store_to_base_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Base Rate' + )->addColumn( + 'base_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Amount' + )->addColumn( + 'total_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Qty' + )->addColumn( + 'base_to_global_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Global Rate' + )->addColumn( + 'subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal' + )->addColumn( + 'base_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Amount' + )->addColumn( + 'billing_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Billing Address Id' + )->addColumn( + 'is_used_for_refund', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Used For Refund' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'email_sent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Email Sent' + )->addColumn( + 'can_void_flag', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Can Void Flag' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'State' + )->addColumn( + 'shipping_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipping Address Id' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Store Currency Code' + )->addColumn( + 'transaction_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Transaction Id' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Order Currency Code' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Global Currency Code' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'shipping_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Hidden Tax Amount' + )->addColumn( + 'base_shipping_hidden_tax_amnt', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Hidden Tax Amount' + )->addColumn( + 'shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Incl Tax' + )->addColumn( + 'base_shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Incl Tax' + )->addColumn( + 'base_total_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Refunded' + )->addColumn( + 'discount_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Discount Description' + )->addIndex( + $installer->getIdxName('sales_invoice', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_invoice', ['grand_total']), + ['grand_total'] + )->addIndex( + $installer->getIdxName('sales_invoice', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_invoice', ['state']), + ['state'] + )->addIndex( + $installer->getIdxName( + 'sales_invoice', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_invoice', ['created_at']), + ['created_at'] + )->addForeignKey( + $installer->getFkName('sales_invoice', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_invoice', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Invoice' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoice_grid' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice_grid') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'State' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Store Currency Code' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Order Currency Code' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Global Currency Code' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'order_increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'order_created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Order Created At' + )->addColumn( + 'billing_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Billing Name' + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['grand_total']), + ['grand_total'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['state']), + ['state'] + )->addIndex( + $installer->getIdxName( + 'sales_invoice_grid', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['order_increment_id']), + ['order_increment_id'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['order_created_at']), + ['order_created_at'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['billing_name']), + ['billing_name'] + )->addForeignKey( + $installer->getFkName('sales_invoice_grid', 'entity_id', 'sales_invoice', 'entity_id'), + 'entity_id', + $installer->getTable('sales_invoice'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_invoice_grid', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Invoice Grid' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoice_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice_item') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'base_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Amount' + )->addColumn( + 'base_row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Amount' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Amount' + )->addColumn( + 'price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price Incl Tax' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Amount' + )->addColumn( + 'base_price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price Incl Tax' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Qty' + )->addColumn( + 'base_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Cost' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + )->addColumn( + 'base_row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total Incl Tax' + )->addColumn( + 'row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total Incl Tax' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Product Id' + )->addColumn( + 'order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Order Item Id' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'tax_ratio', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 512, + [], + 'Ratio of tax invoiced over tax of the order item' + )->addIndex( + $installer->getIdxName('sales_invoice_item', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_invoice_item', 'parent_id', 'sales_invoice', 'entity_id'), + 'parent_id', + $installer->getTable('sales_invoice'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Invoice Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoice_comment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice_comment') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'is_customer_notified', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Customer Notified' + )->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + )->addColumn( + 'comment', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Comment' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addIndex( + $installer->getIdxName('sales_invoice_comment', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_invoice_comment', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_invoice_comment', 'parent_id', 'sales_invoice', 'entity_id'), + 'parent_id', + $installer->getTable('sales_invoice'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Invoice Comment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_creditmemo' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'adjustment_positive', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Adjustment Positive' + )->addColumn( + 'base_shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Tax Amount' + )->addColumn( + 'store_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Order Rate' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Amount' + )->addColumn( + 'base_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Order Rate' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'base_adjustment_negative', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Adjustment Negative' + )->addColumn( + 'base_subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Incl Tax' + )->addColumn( + 'shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Amount' + )->addColumn( + 'subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Incl Tax' + )->addColumn( + 'adjustment_negative', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Adjustment Negative' + )->addColumn( + 'base_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Amount' + )->addColumn( + 'store_to_base_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Base Rate' + )->addColumn( + 'base_to_global_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Global Rate' + )->addColumn( + 'base_adjustment', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Adjustment' + )->addColumn( + 'base_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Amount' + )->addColumn( + 'subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal' + )->addColumn( + 'adjustment', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Adjustment' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'base_adjustment_positive', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Adjustment Positive' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Amount' + )->addColumn( + 'shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Tax Amount' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Amount' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'email_sent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Email Sent' + )->addColumn( + 'creditmemo_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Creditmemo Status' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'State' + )->addColumn( + 'shipping_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipping Address Id' + )->addColumn( + 'billing_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Billing Address Id' + )->addColumn( + 'invoice_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Invoice Id' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Store Currency Code' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Order Currency Code' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Global Currency Code' + )->addColumn( + 'transaction_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Transaction Id' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'shipping_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Hidden Tax Amount' + )->addColumn( + 'base_shipping_hidden_tax_amnt', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Hidden Tax Amount' + )->addColumn( + 'shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Incl Tax' + )->addColumn( + 'base_shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Incl Tax' + )->addColumn( + 'discount_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Discount Description' + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['creditmemo_status']), + ['creditmemo_status'] + )->addIndex( + $installer->getIdxName( + 'sales_creditmemo', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['state']), + ['state'] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['created_at']), + ['created_at'] + )->addForeignKey( + $installer->getFkName('sales_creditmemo', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_creditmemo', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Creditmemo' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_creditmemo_grid' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo_grid') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'store_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Order Rate' + )->addColumn( + 'base_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Order Rate' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'store_to_base_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Base Rate' + )->addColumn( + 'base_to_global_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Global Rate' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'creditmemo_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Creditmemo Status' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'State' + )->addColumn( + 'invoice_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Invoice Id' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Store Currency Code' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Order Currency Code' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Global Currency Code' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'order_increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'order_created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Order Created At' + )->addColumn( + 'billing_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Billing Name' + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['grand_total']), + ['grand_total'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['base_grand_total']), + ['base_grand_total'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['creditmemo_status']), + ['creditmemo_status'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['state']), + ['state'] + )->addIndex( + $installer->getIdxName( + 'sales_creditmemo_grid', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['order_increment_id']), + ['order_increment_id'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['order_created_at']), + ['order_created_at'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['billing_name']), + ['billing_name'] + )->addForeignKey( + $installer->getFkName('sales_creditmemo_grid', 'entity_id', 'sales_creditmemo', 'entity_id'), + 'entity_id', + $installer->getTable('sales_creditmemo'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_creditmemo_grid', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Creditmemo Grid' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_creditmemo_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo_item') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'base_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Amount' + )->addColumn( + 'base_row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Amount' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Amount' + )->addColumn( + 'price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price Incl Tax' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Amount' + )->addColumn( + 'base_price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price Incl Tax' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Qty' + )->addColumn( + 'base_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Cost' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + )->addColumn( + 'base_row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total Incl Tax' + )->addColumn( + 'row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total Incl Tax' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Product Id' + )->addColumn( + 'order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Order Item Id' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'tax_ratio', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 512, + [], + 'Ratio of tax in the creditmemo item over tax of the order item' + )->addIndex( + $installer->getIdxName('sales_creditmemo_item', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_creditmemo_item', 'parent_id', 'sales_creditmemo', 'entity_id'), + 'parent_id', + $installer->getTable('sales_creditmemo'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Creditmemo Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_creditmemo_comment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo_comment') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'is_customer_notified', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Is Customer Notified' + )->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + )->addColumn( + 'comment', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Comment' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addIndex( + $installer->getIdxName('sales_creditmemo_comment', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_comment', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_creditmemo_comment', 'parent_id', 'sales_creditmemo', 'entity_id'), + 'parent_id', + $installer->getTable('sales_creditmemo'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Creditmemo Comment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoiced_aggregated' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoiced_aggregated') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'orders_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Orders Invoiced' + )->addColumn( + 'invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced' + )->addColumn( + 'invoiced_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced Captured' + )->addColumn( + 'invoiced_not_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced Not Captured' + )->addIndex( + $installer->getIdxName( + 'sales_invoiced_aggregated', + ['period', 'store_id', 'order_status'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_invoiced_aggregated', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Invoiced Aggregated' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoiced_aggregated_order' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoiced_aggregated_order') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false, 'default' => false], + 'Order Status' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'orders_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Orders Invoiced' + )->addColumn( + 'invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced' + )->addColumn( + 'invoiced_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced Captured' + )->addColumn( + 'invoiced_not_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced Not Captured' + )->addIndex( + $installer->getIdxName( + 'sales_invoiced_aggregated_order', + ['period', 'store_id', 'order_status'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_invoiced_aggregated_order', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Invoiced Aggregated Order' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_aggregated_created' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_aggregated_created') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false, 'default' => false], + 'Order Status' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'total_qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Qty Ordered' + )->addColumn( + 'total_qty_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Qty Invoiced' + )->addColumn( + 'total_income_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Income Amount' + )->addColumn( + 'total_revenue_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Revenue Amount' + )->addColumn( + 'total_profit_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Profit Amount' + )->addColumn( + 'total_invoiced_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Invoiced Amount' + )->addColumn( + 'total_canceled_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Canceled Amount' + )->addColumn( + 'total_paid_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Paid Amount' + )->addColumn( + 'total_refunded_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Refunded Amount' + )->addColumn( + 'total_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Tax Amount' + )->addColumn( + 'total_tax_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Tax Amount Actual' + )->addColumn( + 'total_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Shipping Amount' + )->addColumn( + 'total_shipping_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Shipping Amount Actual' + )->addColumn( + 'total_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Discount Amount' + )->addColumn( + 'total_discount_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Discount Amount Actual' + )->addIndex( + $installer->getIdxName( + 'sales_order_aggregated_created', + ['period', 'store_id', 'order_status'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_order_aggregated_created', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Order Aggregated Created' + ); + $installer->getConnection()->createTable($table); + + $installer->getConnection()->createTable( + $installer->getConnection()->createTableByDdl( + $installer->getTable('sales_order_aggregated_created'), + $installer->getTable('sales_order_aggregated_updated') + ) + ); + + /** + * Create table 'sales_payment_transaction' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_payment_transaction') + )->addColumn( + 'transaction_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Transaction Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Id' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Order Id' + )->addColumn( + 'payment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Payment Id' + )->addColumn( + 'txn_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + [], + 'Txn Id' + )->addColumn( + 'parent_txn_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + [], + 'Parent Txn Id' + )->addColumn( + 'txn_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 15, + [], + 'Txn Type' + )->addColumn( + 'is_closed', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Closed' + )->addColumn( + 'additional_information', + \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, + '64K', + [], + 'Additional Information' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addIndex( + $installer->getIdxName( + 'sales_payment_transaction', + ['order_id', 'payment_id', 'txn_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['order_id', 'payment_id', 'txn_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_payment_transaction', ['parent_id']), + ['parent_id'] + )->addIndex( + $installer->getIdxName('sales_payment_transaction', ['payment_id']), + ['payment_id'] + )->addForeignKey( + $installer->getFkName('sales_payment_transaction', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_payment_transaction', 'parent_id', 'sales_payment_transaction', 'transaction_id'), + 'parent_id', + $installer->getTable('sales_payment_transaction'), + 'transaction_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_payment_transaction', 'payment_id', 'sales_order_payment', 'entity_id'), + 'payment_id', + $installer->getTable('sales_order_payment'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Payment Transaction' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_refunded_aggregated' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_refunded_aggregated') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false, 'default' => false], + 'Order Status' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Refunded' + )->addColumn( + 'online_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Online Refunded' + )->addColumn( + 'offline_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Offline Refunded' + )->addIndex( + $installer->getIdxName( + 'sales_refunded_aggregated', + ['period', 'store_id', 'order_status'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_refunded_aggregated', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Refunded Aggregated' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_refunded_aggregated_order' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_refunded_aggregated_order') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Refunded' + )->addColumn( + 'online_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Online Refunded' + )->addColumn( + 'offline_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Offline Refunded' + )->addIndex( + $installer->getIdxName( + 'sales_refunded_aggregated_order', + ['period', 'store_id', 'order_status'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_refunded_aggregated_order', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Refunded Aggregated Order' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipping_aggregated' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipping_aggregated') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'shipping_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Description' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'total_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Shipping' + )->addColumn( + 'total_shipping_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Shipping Actual' + )->addIndex( + $installer->getIdxName( + 'sales_shipping_aggregated', + ['period', 'store_id', 'order_status', 'shipping_description'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status', 'shipping_description'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_shipping_aggregated', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Shipping Aggregated' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipping_aggregated_order' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipping_aggregated_order') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'shipping_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Description' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'total_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Shipping' + )->addColumn( + 'total_shipping_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Shipping Actual' + )->addIndex( + $installer->getIdxName( + 'sales_shipping_aggregated_order', + ['period', 'store_id', 'order_status', 'shipping_description'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status', 'shipping_description'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_shipping_aggregated_order', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Shipping Aggregated Order' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_bestsellers_aggregated_daily' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_bestsellers_aggregated_daily') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + )->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + )->addColumn( + 'qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty Ordered' + )->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + )->addIndex( + $installer->getIdxName( + 'sales_bestsellers_aggregated_daily', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_daily', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_daily', ['product_id']), + ['product_id'] + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_daily', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Bestsellers Aggregated Daily' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_bestsellers_aggregated_monthly' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_bestsellers_aggregated_monthly') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + )->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + )->addColumn( + 'qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty Ordered' + )->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + )->addIndex( + $installer->getIdxName( + 'sales_bestsellers_aggregated_monthly', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_monthly', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_monthly', ['product_id']), + ['product_id'] + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_monthly', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Bestsellers Aggregated Monthly' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_bestsellers_aggregated_yearly' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_bestsellers_aggregated_yearly') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + )->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + )->addColumn( + 'qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty Ordered' + )->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + )->addIndex( + $installer->getIdxName( + 'sales_bestsellers_aggregated_yearly', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_yearly', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_yearly', ['product_id']), + ['product_id'] + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_yearly', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Bestsellers Aggregated Yearly' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_tax' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_tax') + )->addColumn( + 'tax_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Tax Id' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Code' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Title' + )->addColumn( + 'percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Percent' + )->addColumn( + 'amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount' + )->addColumn( + 'priority', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Priority' + )->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Position' + )->addColumn( + 'base_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount' + )->addColumn( + 'process', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false], + 'Process' + )->addColumn( + 'base_real_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Real Amount' + )->addColumn( + 'hidden', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Hidden' + )->addIndex( + $installer->getIdxName('sales_order_tax', ['order_id', 'priority', 'position']), + ['order_id', 'priority', 'position'] + )->setComment( + 'Sales Order Tax Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_status' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status') + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Status' + )->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 128, + ['nullable' => false], + 'Label' + )->setComment( + 'Sales Order Status Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_status_state' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status_state') + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Status' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Label' + )->addColumn( + 'is_default', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Default' + )->addColumn( + 'visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 1, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Visible on front' + )->addForeignKey( + $installer->getFkName('sales_order_status_state', 'status', 'sales_order_status', 'status'), + 'status', + $installer->getTable('sales_order_status'), + 'status', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Order Status Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_status_label' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status_label') + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Status' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store Id' + )->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 128, + ['nullable' => false], + 'Label' + )->addIndex( + $installer->getIdxName('sales_order_status_label', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_order_status_label', 'status', 'sales_order_status', 'status'), + 'status', + $installer->getTable('sales_order_status'), + 'status', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Order Status Label Table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..229c42f987cd4 --- /dev/null +++ b/app/code/Magento/Sales/Setup/UpgradeSchema.php @@ -0,0 +1,62 @@ +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); + } + } + } + } +} \ No newline at end of file diff --git a/app/code/Magento/SalesRule/Setup/InstallData.php b/app/code/Magento/SalesRule/Setup/InstallData.php new file mode 100755 index 0000000000000..cbc44a56371ab --- /dev/null +++ b/app/code/Magento/SalesRule/Setup/InstallData.php @@ -0,0 +1,45 @@ +createMigrationSetup(); + $installer->startSetup(); + + $installer->appendClassAliasReplace( + 'salesrule', + 'conditions_serialized', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + ['rule_id'] + ); + $installer->appendClassAliasReplace( + 'salesrule', + 'actions_serialized', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + ['rule_id'] + ); + + $installer->doUpdateClassAliases(); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/SalesRule/Setup/InstallSchema.php b/app/code/Magento/SalesRule/Setup/InstallSchema.php new file mode 100644 index 0000000000000..304b7b20c885d --- /dev/null +++ b/app/code/Magento/SalesRule/Setup/InstallSchema.php @@ -0,0 +1,798 @@ +startSetup(); + + /** + * Create table 'salesrule' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule') + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'from_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => true, 'default' => null], + 'From Date' + )->addColumn( + 'to_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => true, 'default' => null], + 'To Date' + )->addColumn( + 'uses_per_customer', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Uses Per Customer' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Is Active' + )->addColumn( + 'conditions_serialized', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Conditions Serialized' + )->addColumn( + 'actions_serialized', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Actions Serialized' + )->addColumn( + 'stop_rules_processing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Stop Rules Processing' + )->addColumn( + 'is_advanced', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Advanced' + )->addColumn( + 'product_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Product Ids' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + )->addColumn( + 'simple_action', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Simple Action' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'discount_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + [], + 'Discount Qty' + )->addColumn( + 'discount_step', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Discount Step' + )->addColumn( + 'apply_to_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Apply To Shipping' + )->addColumn( + 'times_used', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Times Used' + )->addColumn( + 'is_rss', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Is Rss' + )->addColumn( + 'coupon_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Coupon Type' + )->addColumn( + 'use_auto_generation', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => false, 'nullable' => false, 'default' => 0], + 'Use Auto Generation' + )->addColumn( + 'uses_per_coupon', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => 0], + 'User Per Coupon' + )->addIndex( + $installer->getIdxName('salesrule', ['is_active', 'sort_order', 'to_date', 'from_date']), + ['is_active', 'sort_order', 'to_date', 'from_date'] + )->setComment( + 'Salesrule' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_coupon' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon') + )->addColumn( + 'coupon_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Coupon Id' + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Rule Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Code' + )->addColumn( + 'usage_limit', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Usage Limit' + )->addColumn( + 'usage_per_customer', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Usage Per Customer' + )->addColumn( + 'times_used', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Times Used' + )->addColumn( + 'expiration_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Expiration Date' + )->addColumn( + 'is_primary', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Primary' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Coupon Code Creation Date' + )->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => true, 'default' => 0], + 'Coupon Code Type' + )->addIndex( + $installer->getIdxName( + 'salesrule_coupon', + ['code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName( + 'salesrule_coupon', + ['rule_id', 'is_primary'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['rule_id', 'is_primary'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('salesrule_coupon', ['rule_id']), + ['rule_id'] + )->addForeignKey( + $installer->getFkName('salesrule_coupon', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Salesrule Coupon' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_coupon_usage' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon_usage') + )->addColumn( + 'coupon_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Coupon Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Id' + )->addColumn( + 'times_used', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Times Used' + )->addIndex( + $installer->getIdxName('salesrule_coupon_usage', ['customer_id']), + ['customer_id'] + )->addForeignKey( + $installer->getFkName('salesrule_coupon_usage', 'coupon_id', 'salesrule_coupon', 'coupon_id'), + 'coupon_id', + $installer->getTable('salesrule_coupon'), + 'coupon_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Salesrule Coupon Usage' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_customer' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_customer') + )->addColumn( + 'rule_customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Customer Id' + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rule Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Id' + )->addColumn( + 'times_used', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Times Used' + )->addIndex( + $installer->getIdxName('salesrule_customer', ['rule_id', 'customer_id']), + ['rule_id', 'customer_id'] + )->addIndex( + $installer->getIdxName('salesrule_customer', ['customer_id', 'rule_id']), + ['customer_id', 'rule_id'] + )->addForeignKey( + $installer->getFkName('salesrule_customer', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Salesrule Customer' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_label' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_label') + )->addColumn( + 'label_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Label Id' + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Rule Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + )->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Label' + )->addIndex( + $installer->getIdxName( + 'salesrule_label', + ['rule_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['rule_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('salesrule_label', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('salesrule_label', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('salesrule_label', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Salesrule Label' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_product_attribute' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_product_attribute') + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + )->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Id' + )->addIndex( + $installer->getIdxName('salesrule_product_attribute', ['website_id']), + ['website_id'] + )->addIndex( + $installer->getIdxName('salesrule_product_attribute', ['customer_group_id']), + ['customer_group_id'] + )->addIndex( + $installer->getIdxName('salesrule_product_attribute', ['attribute_id']), + ['attribute_id'] + )->addForeignKey( + $installer->getFkName('salesrule_product_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + )->addForeignKey( + $installer->getFkName('salesrule_product_attribute', 'customer_group_id', 'customer_group', 'customer_group_id'), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + )->addForeignKey( + $installer->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + )->addForeignKey( + $installer->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + )->setComment( + 'Salesrule Product Attribute' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_coupon_aggregated' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon_aggregated') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => false], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'coupon_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Coupon Code' + )->addColumn( + 'coupon_uses', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Coupon Uses' + )->addColumn( + 'subtotal_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Subtotal Amount' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'total_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Total Amount' + )->addColumn( + 'subtotal_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Subtotal Amount Actual' + )->addColumn( + 'discount_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount Actual' + )->addColumn( + 'total_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Total Amount Actual' + )->addColumn( + 'rule_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Rule Name' + )->addIndex( + $installer->getIdxName( + 'salesrule_coupon_aggregated', + ['period', 'store_id', 'order_status', 'coupon_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status', 'coupon_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('salesrule_coupon_aggregated', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('salesrule_coupon_aggregated', ['rule_name']), + ['rule_name'] + )->addForeignKey( + $installer->getFkName('salesrule_coupon_aggregated', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Coupon Aggregated' + ); + $installer->getConnection()->createTable($table); + + $installer->getConnection()->createTable( + $installer->getConnection()->createTableByDdl( + $installer->getTable('salesrule_coupon_aggregated'), + $installer->getTable('salesrule_coupon_aggregated_updated') + ) + ); + + /** + * Create table 'salesrule_coupon_aggregated_order' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon_aggregated_order') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => false], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'coupon_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Coupon Code' + )->addColumn( + 'coupon_uses', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Coupon Uses' + )->addColumn( + 'subtotal_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Subtotal Amount' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'total_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Total Amount' + )->addColumn( + 'rule_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Rule Name' + )->addIndex( + $installer->getIdxName( + 'salesrule_coupon_aggregated_order', + ['period', 'store_id', 'order_status', 'coupon_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status', 'coupon_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('salesrule_coupon_aggregated_order', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('salesrule_coupon_aggregated_order', ['rule_name']), + ['rule_name'] + )->addForeignKey( + $installer->getFkName('salesrule_coupon_aggregated_order', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Coupon Aggregated Order' + ); + $installer->getConnection()->createTable($table); + + $websitesTable = $installer->getTable('store_website'); + $customerGroupsTable = $installer->getTable('customer_group'); + $rulesWebsitesTable = $installer->getTable('salesrule_website'); + $rulesCustomerGroupsTable = $installer->getTable('salesrule_customer_group'); + + /** + * Create table 'salesrule_website' if not exists. This table will be used instead of + * column website_ids of main catalog rules table + */ + $table = $installer->getConnection()->newTable( + $rulesWebsitesTable + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + )->addIndex( + $installer->getIdxName('salesrule_website', ['website_id']), + ['website_id'] + )->addForeignKey( + $installer->getFkName('salesrule_website', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'), + 'website_id', + $websitesTable, + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Rules To Websites Relations' + ); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_customer_group' if not exists. This table will be used instead of + * column customer_group_ids of main catalog rules table + */ + $table = $installer->getConnection()->newTable( + $rulesCustomerGroupsTable + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + )->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + )->addIndex( + $installer->getIdxName('salesrule_customer_group', ['customer_group_id']), + ['customer_group_id'] + )->addForeignKey( + $installer->getFkName('salesrule_customer_group', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('salesrule_customer_group', 'customer_group_id', 'customer_group', 'customer_group_id'), + 'customer_group_id', + $customerGroupsTable, + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Rules To Customer Groups Relations' + ); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Search/Setup/InstallSchema.php b/app/code/Magento/Search/Setup/InstallSchema.php new file mode 100644 index 0000000000000..91f9833679d2d --- /dev/null +++ b/app/code/Magento/Search/Setup/InstallSchema.php @@ -0,0 +1,134 @@ +startSetup(); + + /** + * Create table 'search_query' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('search_query')) + ->addColumn( + 'query_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Query ID' + ) + ->addColumn( + 'query_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Query text' + ) + ->addColumn( + 'num_results', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Num results' + ) + ->addColumn( + 'popularity', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Popularity' + ) + ->addColumn( + 'redirect', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Redirect' + ) + ->addColumn( + 'synonym_for', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Synonym for' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'display_in_terms', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Display in terms' + ) + ->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['default' => '1'], + 'Active status' + ) + ->addColumn( + 'is_processed', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['default' => '0'], + 'Processed status' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Updated at' + ) + ->addIndex( + $installer->getIdxName('search_query', ['query_text', 'store_id', 'popularity']), + ['query_text', 'store_id', 'popularity'] + ) + ->addIndex( + $installer->getIdxName('search_query', 'store_id'), + 'store_id' + ) + ->addIndex( + $installer->getIdxName('search_query', 'synonym_for'), + 'synonym_for' + ) + ->addForeignKey( + $installer->getFkName('search_query', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Search query table'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Sendfriend/Setup/InstallSchema.php b/app/code/Magento/Sendfriend/Setup/InstallSchema.php new file mode 100644 index 0000000000000..9a41215aee0e1 --- /dev/null +++ b/app/code/Magento/Sendfriend/Setup/InstallSchema.php @@ -0,0 +1,66 @@ +startSetup(); + + $table = $installer->getConnection()->newTable( + $installer->getTable('sendfriend_log') + )->addColumn( + 'log_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Log ID' + )->addColumn( + 'ip', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + '20', + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer IP address' + )->addColumn( + 'time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Log time' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website ID' + )->addIndex( + $installer->getIdxName('sendfriend_log', 'ip'), + 'ip' + )->addIndex( + $installer->getIdxName('sendfriend_log', 'time'), + 'time' + )->setComment( + 'Send to friend function log storage table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Setup/InstallSchema.php b/app/code/Magento/Sitemap/Setup/InstallSchema.php new file mode 100644 index 0000000000000..6ac3750e2f5bf --- /dev/null +++ b/app/code/Magento/Sitemap/Setup/InstallSchema.php @@ -0,0 +1,86 @@ +startSetup(); + + /** + * Create table 'sitemap' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sitemap') + )->addColumn( + 'sitemap_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Sitemap Id' + )->addColumn( + 'sitemap_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Sitemap Type' + )->addColumn( + 'sitemap_filename', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Sitemap Filename' + )->addColumn( + 'sitemap_path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sitemap Path' + )->addColumn( + 'sitemap_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Sitemap Time' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store id' + )->addIndex( + $installer->getIdxName('sitemap', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sitemap', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'XML Sitemap' + ); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Store/Setup/InstallSchema.php b/app/code/Magento/Store/Setup/InstallSchema.php new file mode 100644 index 0000000000000..ac1f9a3882d6e --- /dev/null +++ b/app/code/Magento/Store/Setup/InstallSchema.php @@ -0,0 +1,294 @@ +startSetup(); + $connection = $installer->getConnection(); + + /** + * Create table 'store_website' + */ + $table = $connection->newTable( + $installer->getTable('store_website') + )->addColumn( + 'website_id', + Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + )->addColumn( + 'code', + Table::TYPE_TEXT, + 32, + [], + 'Code' + )->addColumn( + 'name', + Table::TYPE_TEXT, + 64, + [], + 'Website Name' + )->addColumn( + 'sort_order', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + )->addColumn( + 'default_group_id', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Default Group Id' + )->addColumn( + 'is_default', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Defines Is Website Default' + )->addIndex( + $installer->getIdxName( + 'store_website', + ['code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('store_website', ['sort_order']), + ['sort_order'] + )->addIndex( + $installer->getIdxName('store_website', ['default_group_id']), + ['default_group_id'] + )->setComment( + 'Websites' + ); + $connection->createTable($table); + + /** + * Create table 'store_group' + */ + $table = $connection->newTable( + $installer->getTable('store_group') + )->addColumn( + 'group_id', + Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Group Id' + )->addColumn( + 'website_id', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website Id' + )->addColumn( + 'name', + Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Store Group Name' + )->addColumn( + 'root_category_id', + Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Root Category Id' + )->addColumn( + 'default_store_id', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Default Store Id' + )->addIndex( + $installer->getIdxName('store_group', ['website_id']), + ['website_id'] + )->addIndex( + $installer->getIdxName('store_group', ['default_store_id']), + ['default_store_id'] + )->addForeignKey( + $installer->getFkName('store_group', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + Table::ACTION_CASCADE, + Table::ACTION_CASCADE + )->setComment( + 'Store Groups' + ); + $connection->createTable($table); + + /** + * Create table 'store' + */ + $table = $connection->newTable( + $installer->getTable('store') + )->addColumn( + 'store_id', + Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store Id' + )->addColumn( + 'code', + Table::TYPE_TEXT, + 32, + [], + 'Code' + )->addColumn( + 'website_id', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website Id' + )->addColumn( + 'group_id', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Group Id' + )->addColumn( + 'name', + Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Store Name' + )->addColumn( + 'sort_order', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Sort Order' + )->addColumn( + 'is_active', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Activity' + )->addIndex( + $installer->getIdxName('store', ['code'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), + ['code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('store', ['website_id']), + ['website_id'] + )->addIndex( + $installer->getIdxName('store', ['is_active', 'sort_order']), + ['is_active', 'sort_order'] + )->addIndex( + $installer->getIdxName('store', ['group_id']), + ['group_id'] + )->addForeignKey( + $installer->getFkName('store', 'group_id', 'store_group', 'group_id'), + 'group_id', + $installer->getTable('store_group'), + 'group_id', + Table::ACTION_CASCADE, + Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('store', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + Table::ACTION_CASCADE, + Table::ACTION_CASCADE + )->setComment( + 'Stores' + ); + $connection->createTable($table); + + /** + * Insert websites + */ + $connection->insertForce( + $installer->getTable('store_website'), + [ + 'website_id' => 0, + 'code' => 'admin', + 'name' => 'Admin', + 'sort_order' => 0, + 'default_group_id' => 0, + 'is_default' => 0 + ] + ); + $connection->insertForce( + $installer->getTable('store_website'), + [ + 'website_id' => 1, + 'code' => 'base', + 'name' => 'Main Website', + 'sort_order' => 0, + 'default_group_id' => 1, + 'is_default' => 1 + ] + ); + + /** + * Insert store groups + */ + $connection->insertForce( + $installer->getTable('store_group'), + ['group_id' => 0, 'website_id' => 0, 'name' => 'Default', 'root_category_id' => 0, 'default_store_id' => 0] + ); + $connection->insertForce( + $installer->getTable('store_group'), + [ + 'group_id' => 1, + 'website_id' => 1, + 'name' => 'Main Website Store', + 'root_category_id' => 2, + 'default_store_id' => 1 + ] + ); + + /** + * Insert stores + */ + $connection->insertForce( + $installer->getTable('store'), + [ + 'store_id' => 0, + 'code' => 'admin', + 'website_id' => 0, + 'group_id' => 0, + 'name' => 'Admin', + 'sort_order' => 0, + 'is_active' => 1 + ] + ); + $connection->insertForce( + $installer->getTable('store'), + [ + 'store_id' => 1, + 'code' => 'default', + 'website_id' => 1, + 'group_id' => 1, + 'name' => 'Default Store View', + 'sort_order' => 0, + 'is_active' => 1 + ] + ); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Tax/Setup/InstallSchema.php b/app/code/Magento/Tax/Setup/InstallSchema.php new file mode 100644 index 0000000000000..f07089f37527e --- /dev/null +++ b/app/code/Magento/Tax/Setup/InstallSchema.php @@ -0,0 +1,517 @@ +startSetup(); + + /** + * Create table 'tax_class' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_class') + )->addColumn( + 'class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Class Id' + )->addColumn( + 'class_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Class Name' + )->addColumn( + 'class_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 8, + ['nullable' => false, 'default' => 'CUSTOMER'], + 'Class Type' + )->setComment( + 'Tax Class' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_calculation_rule' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_calculation_rule') + )->addColumn( + 'tax_calculation_rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Tax Calculation Rule Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Code' + )->addColumn( + 'priority', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Priority' + )->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Position' + )->addColumn( + 'calculate_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Calculate off subtotal option' + )->addIndex( + $setup->getIdxName('tax_calculation_rule', ['priority', 'position']), + ['priority', 'position'] + )->addIndex( + $setup->getIdxName('tax_calculation_rule', ['code']), + ['code'] + )->setComment( + 'Tax Calculation Rule' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_calculation_rate' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_calculation_rate') + )->addColumn( + 'tax_calculation_rate_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Tax Calculation Rate Id' + )->addColumn( + 'tax_country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + ['nullable' => false], + 'Tax Country Id' + )->addColumn( + 'tax_region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Tax Region Id' + )->addColumn( + 'tax_postcode', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 21, + [], + 'Tax Postcode' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Code' + )->addColumn( + 'rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Rate' + )->addColumn( + 'zip_is_range', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + [], + 'Zip Is Range' + )->addColumn( + 'zip_from', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Zip From' + )->addColumn( + 'zip_to', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Zip To' + )->addIndex( + $setup->getIdxName('tax_calculation_rate', ['tax_country_id', 'tax_region_id', 'tax_postcode']), + ['tax_country_id', 'tax_region_id', 'tax_postcode'] + )->addIndex( + $setup->getIdxName('tax_calculation_rate', ['code']), + ['code'] + )->addIndex( + $setup->getIdxName( + 'tax_calculation_rate', + ['tax_calculation_rate_id', 'tax_country_id', 'tax_region_id', 'zip_is_range', 'tax_postcode'] + ), + ['tax_calculation_rate_id', 'tax_country_id', 'tax_region_id', 'zip_is_range', 'tax_postcode'] + )->setComment( + 'Tax Calculation Rate' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_calculation' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_calculation') + )->addColumn( + 'tax_calculation_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Tax Calculation Id' + )->addColumn( + 'tax_calculation_rate_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Tax Calculation Rate Id' + )->addColumn( + 'tax_calculation_rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Tax Calculation Rule Id' + )->addColumn( + 'customer_tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false], + 'Customer Tax Class Id' + )->addColumn( + 'product_tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false], + 'Product Tax Class Id' + )->addIndex( + $setup->getIdxName('tax_calculation', ['tax_calculation_rule_id']), + ['tax_calculation_rule_id'] + )->addIndex( + $setup->getIdxName('tax_calculation', ['customer_tax_class_id']), + ['customer_tax_class_id'] + )->addIndex( + $setup->getIdxName('tax_calculation', ['product_tax_class_id']), + ['product_tax_class_id'] + )->addIndex( + $setup->getIdxName( + 'tax_calculation', + ['tax_calculation_rate_id', 'customer_tax_class_id', 'product_tax_class_id'] + ), + ['tax_calculation_rate_id', 'customer_tax_class_id', 'product_tax_class_id'] + )->addForeignKey( + $setup->getFkName('tax_calculation', 'product_tax_class_id', 'tax_class', 'class_id'), + 'product_tax_class_id', + $setup->getTable('tax_class'), + 'class_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName('tax_calculation', 'customer_tax_class_id', 'tax_class', 'class_id'), + 'customer_tax_class_id', + $setup->getTable('tax_class'), + 'class_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName( + 'tax_calculation', + 'tax_calculation_rate_id', + 'tax_calculation_rate', + 'tax_calculation_rate_id' + ), + 'tax_calculation_rate_id', + $setup->getTable('tax_calculation_rate'), + 'tax_calculation_rate_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName( + 'tax_calculation', + 'tax_calculation_rule_id', + 'tax_calculation_rule', + 'tax_calculation_rule_id' + ), + 'tax_calculation_rule_id', + $setup->getTable('tax_calculation_rule'), + 'tax_calculation_rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Tax Calculation' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_calculation_rate_title' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_calculation_rate_title') + )->addColumn( + 'tax_calculation_rate_title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Tax Calculation Rate Title Id' + )->addColumn( + 'tax_calculation_rate_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Tax Calculation Rate Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Value' + )->addIndex( + $setup->getIdxName('tax_calculation_rate_title', ['tax_calculation_rate_id', 'store_id']), + ['tax_calculation_rate_id', 'store_id'] + )->addIndex( + $setup->getIdxName('tax_calculation_rate_title', ['store_id']), + ['store_id'] + )->addForeignKey( + $setup->getFkName('tax_calculation_rate_title', 'store_id', 'store', 'store_id'), + 'store_id', + $setup->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName( + 'tax_calculation_rate_title', + 'tax_calculation_rate_id', + 'tax_calculation_rate', + 'tax_calculation_rate_id' + ), + 'tax_calculation_rate_id', + $setup->getTable('tax_calculation_rate'), + 'tax_calculation_rate_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Tax Calculation Rate Title' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_order_aggregated_created' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_order_aggregated_created') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => true], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Code' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false], + 'Order Status' + )->addColumn( + 'percent', + \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, + null, + [], + 'Percent' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'tax_base_amount_sum', + \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, + null, + [], + 'Tax Base Amount Sum' + )->addIndex( + $setup->getIdxName( + 'tax_order_aggregated_created', + ['period', 'store_id', 'code', 'percent', 'order_status'], + true + ), + ['period', 'store_id', 'code', 'percent', 'order_status'], + ['type' => 'unique'] + )->addIndex( + $setup->getIdxName('tax_order_aggregated_created', ['store_id']), + ['store_id'] + )->addForeignKey( + $setup->getFkName('tax_order_aggregated_created', 'store_id', 'store', 'store_id'), + 'store_id', + $setup->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Tax Order Aggregation' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_order_aggregated_updated' + */ + $setup->getConnection()->createTable( + $setup->getConnection()->createTableByDdl( + $setup->getTable('tax_order_aggregated_created'), + $setup->getTable('tax_order_aggregated_updated') + ) + ); + + /** + * Create table 'sales_order_tax_item' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('sales_order_tax_item') + )->addColumn( + 'tax_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Tax Item Id' + )->addColumn( + 'tax_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Tax Id' + )->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true], + 'Item Id' + )->addColumn( + 'tax_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Real Tax Percent For Item' + )->addColumn( + 'amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Tax amount for the item and tax rate' + )->addColumn( + 'base_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Base tax amount for the item and tax rate' + )->addColumn( + 'real_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Real tax amount for the item and tax rate' + )->addColumn( + 'real_base_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Real base tax amount for the item and tax rate' + )->addColumn( + 'associated_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => true, 'unsigned' => true], + 'Id of the associated item' + )->addColumn( + 'taxable_item_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Type of the taxable item' + )->addIndex( + $setup->getIdxName('sales_order_tax_item', ['item_id']), + ['item_id'] + )->addIndex( + $setup->getIdxName( + 'sales_order_tax_item', + ['tax_id', 'item_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['tax_id', 'item_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $setup->getFkName('sales_order_tax_item', 'associated_item_id', 'sales_order_item', 'item_id'), + 'associated_item_id', + $setup->getTable('sales_order_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName('sales_order_tax_item', 'tax_id', 'sales_order_tax', 'tax_id'), + 'tax_id', + $setup->getTable('sales_order_tax'), + 'tax_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName('sales_order_tax_item', 'item_id', 'sales_order_item', 'item_id'), + 'item_id', + $setup->getTable('sales_order_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Order Tax Item' + ); + $setup->getConnection()->createTable($table); + + $setup->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Theme/Setup/InstallSchema.php b/app/code/Magento/Theme/Setup/InstallSchema.php new file mode 100644 index 0000000000000..89e5325984e5c --- /dev/null +++ b/app/code/Magento/Theme/Setup/InstallSchema.php @@ -0,0 +1,161 @@ +getConnection(); + + $installer->startSetup(); + + /** + * Create table 'theme' + */ + $table = $connection->newTable( + $installer->getTable('theme') + )->addColumn( + 'theme_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Theme identifier' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => true], + 'Parent Id' + )->addColumn( + 'theme_path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 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, + 255, + ['nullable' => false], + 'Theme Title' + )->addColumn( + 'preview_image', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Preview Image' + )->addColumn( + 'is_featured', + \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, + null, + ['nullable' => false, 'default' => 0], + 'Is Theme Featured' + )->addColumn( + 'area', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Theme Area' + )->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false], + 'Theme type: 0:physical, 1:virtual, 2:staging' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'Full theme code, including package' + )->setComment( + 'Core theme' + ); + $connection->createTable($table); + + /** + * Create table 'theme_file' + */ + $table = $connection->newTable( + $installer->getTable('theme_file') + )->addColumn( + 'theme_files_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Theme files identifier' + )->addColumn( + 'theme_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Theme Id' + )->addColumn( + 'file_path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Relative path to file' + )->addColumn( + 'file_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'File Type' + )->addColumn( + 'content', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + \Magento\Framework\DB\Ddl\Table::MAX_TEXT_SIZE, + ['nullable' => false], + 'File Content' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0], + 'Sort Order' + )->addColumn( + 'is_temporary', + \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, + null, + ['nullable' => false, 'default' => 0], + 'Is Temporary File' + )->addForeignKey( + $installer->getFkName('theme_file', 'theme_id', 'theme', 'theme_id'), + 'theme_id', + $installer->getTable('theme'), + 'theme_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Core theme files' + ); + $connection->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Theme/Setup/UpgradeSchema.php b/app/code/Magento/Theme/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..5201ef7287370 --- /dev/null +++ b/app/code/Magento/Theme/Setup/UpgradeSchema.php @@ -0,0 +1,39 @@ +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(); + } + } +} \ No newline at end of file diff --git a/app/code/Magento/Translation/Setup/InstallSchema.php b/app/code/Magento/Translation/Setup/InstallSchema.php new file mode 100644 index 0000000000000..489313d62544a --- /dev/null +++ b/app/code/Magento/Translation/Setup/InstallSchema.php @@ -0,0 +1,106 @@ +startSetup(); + + /** + * Create table 'translation' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('translation')) + ->addColumn( + 'key_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [ + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ], + 'Key Id of Translation' + )->addColumn( + 'string', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [ + 'nullable' => false, + 'default' => 'Translate String', + ], + 'Translation String' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + [ + 'unsigned' => true, + 'nullable' => false, + 'default' => '0', + ], + 'Store Id' + )->addColumn( + 'translate', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Translate' + )->addColumn( + 'locale', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + [ + 'nullable' => false, + 'default' => 'en_US', + ], + 'Locale' + )->addColumn( + 'crc_string', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + [ + 'nullable' => false, + 'default' => crc32('Translate String') + ], + 'Translation String CRC32 Hash' + )->addIndex( + $installer->getIdxName( + 'translation', + ['store_id', 'locale', 'crc_string', 'string'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['store_id', 'locale', 'crc_string', 'string'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('translation', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment('Translations'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/UrlRewrite/Setup/InstallSchema.php b/app/code/Magento/UrlRewrite/Setup/InstallSchema.php new file mode 100644 index 0000000000000..118fad1e85619 --- /dev/null +++ b/app/code/Magento/UrlRewrite/Setup/InstallSchema.php @@ -0,0 +1,124 @@ +startSetup(); + + /** + * Create table 'url_rewrite' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('url_rewrite')) + ->addColumn( + 'url_rewrite_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rewrite Id' + ) + ->addColumn( + 'entity_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Entity type code' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Entity ID' + ) + ->addColumn( + 'request_path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Request Path' + ) + ->addColumn( + 'target_path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Target Path' + ) + ->addColumn( + 'redirect_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Redirect Type' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + ) + ->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Description' + ) + ->addColumn( + 'is_autogenerated', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Is rewrite generated automatically flag' + ) + ->addColumn( + 'metadata', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Meta data for url rewrite' + ) + ->addIndex( + $installer->getIdxName( + 'url_rewrite', + ['request_path', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['request_path', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('url_rewrite', ['target_path']), + ['target_path'] + ) + ->addIndex( + $installer->getIdxName('url_rewrite', ['store_id', 'entity_id']), + ['store_id', 'entity_id'] + ) + ->setComment('Url Rewrites'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/User/Setup/InstallSchema.php b/app/code/Magento/User/Setup/InstallSchema.php new file mode 100644 index 0000000000000..7c6365c890878 --- /dev/null +++ b/app/code/Magento/User/Setup/InstallSchema.php @@ -0,0 +1,144 @@ +startSetup(); + + /** + * Create table 'admin_user' + */ + if (!$installer->getConnection()->isTableExists($installer->getTable('admin_user'))) { + $table = $installer->getConnection()->newTable( + $installer->getTable('admin_user') + )->addColumn( + 'user_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'User ID' + )->addColumn( + 'firstname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true], + 'User First Name' + )->addColumn( + 'lastname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true], + 'User Last Name' + )->addColumn( + 'email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 128, + ['nullable' => true], + 'User Email' + )->addColumn( + 'username', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + ['nullable' => true], + 'User Login' + )->addColumn( + 'password', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'User Password' + )->addColumn( + 'created', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], + 'User Created Time' + )->addColumn( + 'modified', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'User Modified Time' + )->addColumn( + 'logdate', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'User Last Login Time' + )->addColumn( + 'lognum', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'User Login Number' + )->addColumn( + 'reload_acl_flag', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Reload ACL' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'User Is Active' + )->addColumn( + 'extra', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'User Extra Data' + )->addColumn( + 'rp_token', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 256, + ['nullable' => true, 'default' => null], + 'Reset Password Link Token' + )->addColumn( + 'rp_token_created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true, 'default' => null], + 'Reset Password Link Token Creation Date' + )->addColumn( + 'interface_locale', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 5, + ['nullable' => false, 'default' => 'en_US'], + 'Backend interface locale' + )->addIndex( + $installer->getIdxName( + 'admin_user', + ['username'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['username'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->setComment( + 'Admin User Table' + ); + $installer->getConnection()->createTable($table); + } + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Usps/Setup/InstallData.php b/app/code/Magento/Usps/Setup/InstallData.php new file mode 100755 index 0000000000000..35837bdb52adf --- /dev/null +++ b/app/code/Magento/Usps/Setup/InstallData.php @@ -0,0 +1,101 @@ +getTable('core_config_data'); + $connection = $installer->getConnection(); + + $oldToNewMethodCodesMap = [ + 'First-Class' => '0_FCLE', + 'First-Class Mail International Large Envelope' => 'INT_14', + 'First-Class Mail International Letter' => 'INT_13', + 'First-Class Mail International Letters' => 'INT_13', + 'First-Class Mail International Package' => 'INT_15', + 'First-Class Mail International Parcel' => 'INT_13', + 'First-Class Package International Service' => 'INT_15', + 'First-Class Mail' => '0_FCLE', + 'First-Class Mail Flat' => '0_FCLE', + 'First-Class Mail Large Envelope' => '0_FCLE', + 'First-Class Mail International' => 'INT_14', + 'First-Class Mail Letter' => '0_FCL', + 'First-Class Mail Parcel' => '0_FCP', + 'First-Class Mail Package' => '0_FCP', + 'Parcel Post' => '4', + 'Standard Post' => '4', + 'Media Mail' => '6', + 'Library Mail' => '7', + 'Express Mail' => '3', + 'Express Mail PO to PO' => '3', + 'Express Mail Flat Rate Envelope' => '13', + 'Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee' => '25', + 'Express Mail Sunday/Holiday Guarantee' => '23', + 'Express Mail Flat Rate Envelope Hold For Pickup' => '27', + 'Express Mail Hold For Pickup' => '2', + 'Global Express Guaranteed (GXG)' => 'INT_4', + 'Global Express Guaranteed Non-Document Rectangular' => 'INT_6', + 'Global Express Guaranteed Non-Document Non-Rectangular' => 'INT_7', + 'USPS GXG Envelopes' => 'INT_12', + 'Express Mail International' => 'INT_1', + 'Express Mail International Flat Rate Envelope' => 'INT_10', + 'Priority Mail' => '1', + 'Priority Mail Small Flat Rate Box' => '28', + 'Priority Mail Medium Flat Rate Box' => '17', + 'Priority Mail Large Flat Rate Box' => '22', + 'Priority Mail Flat Rate Envelope' => '16', + 'Priority Mail International' => 'INT_2', + 'Priority Mail International Flat Rate Envelope' => 'INT_8', + 'Priority Mail International Small Flat Rate Box' => 'INT_16', + 'Priority Mail International Medium Flat Rate Box' => 'INT_9', + 'Priority Mail International Large Flat Rate Box' => 'INT_11', + ]; + + $select = $connection->select()->from( + $configDataTable + )->where( + 'path IN (?)', + ['carriers/usps/free_method', 'carriers/usps/allowed_methods'] + ); + $oldConfigValues = $connection->fetchAll($select); + + foreach ($oldConfigValues as $oldValue) { + $newValue = ''; + if (stripos($oldValue['path'], 'free_method') && isset($oldToNewMethodCodesMap[$oldValue['value']])) { + $newValue = $oldToNewMethodCodesMap[$oldValue['value']]; + } elseif (stripos($oldValue['path'], 'allowed_methods')) { + $newValuesList = []; + foreach (explode(',', $oldValue['value']) as $shippingMethod) { + if (isset($oldToNewMethodCodesMap[$shippingMethod])) { + $newValuesList[] = $oldToNewMethodCodesMap[$shippingMethod]; + } + } + $newValue = implode(',', $newValuesList); + } else { + continue; + } + + if ($newValue && $newValue != $oldValue['value']) { + $whereConfigId = $connection->quoteInto('config_id = ?', $oldValue['config_id']); + $connection->update($configDataTable, ['value' => $newValue], $whereConfigId); + } + } + + } +} \ No newline at end of file diff --git a/app/code/Magento/Weee/Setup/InstallSchema.php b/app/code/Magento/Weee/Setup/InstallSchema.php new file mode 100644 index 0000000000000..f52df2f9d27e3 --- /dev/null +++ b/app/code/Magento/Weee/Setup/InstallSchema.php @@ -0,0 +1,124 @@ +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_TEXT, + 255, + ['nullable' => false, 'default' => '*'], + 'State' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Attribute Id' + )->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Entity Type 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(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Weee/Setup/UpgradeSchema.php b/app/code/Magento/Weee/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..d59fd2c06c16e --- /dev/null +++ b/app/code/Magento/Weee/Setup/UpgradeSchema.php @@ -0,0 +1,32 @@ +getVersion(), '2.0.0.1') <= 0) { + $setup->startSetup(); + $connection = $setup->getConnection(); + + //Drop entity_type_id column for wee tax table + $connection->dropColumn($setup->getTable('weee_tax'), 'entity_type_id'); + + $setup->endSetup(); + } + } +} \ No newline at end of file diff --git a/app/code/Magento/Widget/Setup/InstallData.php b/app/code/Magento/Widget/Setup/InstallData.php new file mode 100755 index 0000000000000..c3e86d906852d --- /dev/null +++ b/app/code/Magento/Widget/Setup/InstallData.php @@ -0,0 +1,37 @@ +createMigrationSetup(); + $installer->startSetup(); + + $installer->appendClassAliasReplace( + 'widget_instance', + 'instance_type', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['instance_id'] + ); + $installer->doUpdateClassAliases(); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Widget/Setup/InstallSchema.php b/app/code/Magento/Widget/Setup/InstallSchema.php new file mode 100644 index 0000000000000..c6026bd255d41 --- /dev/null +++ b/app/code/Magento/Widget/Setup/InstallSchema.php @@ -0,0 +1,293 @@ +startSetup(); + + /** + * Create table 'widget' + */ + if (!$installer->getConnection()->isTableExists($installer->getTable('widget'))) { + $table = $installer->getConnection()->newTable( + $installer->getTable('widget') + )->addColumn( + 'widget_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Widget Id' + )->addColumn( + 'widget_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Widget code for template directive' + )->addColumn( + 'widget_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Widget Type' + )->addColumn( + 'parameters', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Parameters' + )->addIndex( + $installer->getIdxName('widget', 'widget_code'), + 'widget_code' + )->setComment( + 'Preconfigured Widgets' + ); + $installer->getConnection()->createTable($table); + } else { + $installer->getConnection()->dropIndex($installer->getTable('widget'), 'IDX_CODE'); + + $tables = [ + $installer->getTable( + 'widget' + ) => [ + 'columns' => [ + 'widget_id' => [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + 'comment' => 'Widget Id', + ], + 'parameters' => [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'length' => '64K', + 'comment' => 'Parameters', + ], + ], + 'comment' => 'Preconfigured Widgets', + ], + ]; + + $installer->getConnection()->modifyTables($tables); + + $installer->getConnection()->changeColumn( + $installer->getTable('widget'), + 'code', + 'widget_code', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'length' => 255, + 'comment' => 'Widget code for template directive' + ] + ); + + $installer->getConnection()->changeColumn( + $installer->getTable('widget'), + 'type', + 'widget_type', + ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Widget Type'] + ); + + $installer->getConnection()->addIndex( + $installer->getTable('widget'), + $installer->getIdxName('widget', ['widget_code']), + ['widget_code'] + ); + } + + /** + * Create table 'widget_instance' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('widget_instance') + )->addColumn( + 'instance_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Instance Id' + )->addColumn( + 'instance_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Instance Type' + )->addColumn( + 'theme_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Theme id' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Widget Title' + )->addColumn( + 'store_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false, 'default' => '0'], + 'Store ids' + )->addColumn( + 'widget_parameters', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Widget parameters' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort order' + )->addForeignKey( + $installer->getFkName('widget_instance', 'theme_id', 'theme', 'theme_id'), + 'theme_id', + $installer->getTable('theme'), + 'theme_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Instances of Widget for Package Theme' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'widget_instance_page' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('widget_instance_page') + )->addColumn( + 'page_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Page Id' + )->addColumn( + 'instance_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Instance Id' + )->addColumn( + 'page_group', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 25, + [], + 'Block Group Type' + )->addColumn( + 'layout_handle', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Layout Handle' + )->addColumn( + 'block_reference', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Container' + )->addColumn( + 'page_for', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 25, + [], + 'For instance entities' + )->addColumn( + 'entities', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Catalog entities (comma separated)' + )->addColumn( + 'page_template', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Path to widget template' + )->addIndex( + $installer->getIdxName('widget_instance_page', 'instance_id'), + 'instance_id' + )->addForeignKey( + $installer->getFkName('widget_instance_page', 'instance_id', 'widget_instance', 'instance_id'), + 'instance_id', + $installer->getTable('widget_instance'), + 'instance_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Instance of Widget on Page' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'widget_instance_page_layout' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('widget_instance_page_layout') + )->addColumn( + 'page_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Page Id' + )->addColumn( + 'layout_update_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Layout Update Id' + )->addIndex( + $installer->getIdxName('widget_instance_page_layout', 'page_id'), + 'page_id' + )->addIndex( + $installer->getIdxName( + 'widget_instance_page_layout', + ['layout_update_id', 'page_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['layout_update_id', 'page_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('widget_instance_page_layout', 'page_id', 'widget_instance_page', 'page_id'), + 'page_id', + $installer->getTable('widget_instance_page'), + 'page_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('widget_instance_page_layout', 'layout_update_id', 'core_layout_update', 'layout_update_id'), + 'layout_update_id', + $installer->getTable('core_layout_update'), + 'layout_update_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Layout updates' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file diff --git a/app/code/Magento/Wishlist/Setup/InstallSchema.php b/app/code/Magento/Wishlist/Setup/InstallSchema.php new file mode 100644 index 0000000000000..97bea7c814f92 --- /dev/null +++ b/app/code/Magento/Wishlist/Setup/InstallSchema.php @@ -0,0 +1,212 @@ +startSetup(); + + /** + * Create table 'wishlist' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('wishlist') + )->addColumn( + 'wishlist_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Wishlist ID' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer ID' + )->addColumn( + 'shared', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sharing flag (0 or 1)' + )->addColumn( + 'sharing_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Sharing encrypted code' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Last updated date' + )->addIndex( + $installer->getIdxName('wishlist', 'shared'), + 'shared' + )->addIndex( + $installer->getIdxName('wishlist', 'customer_id', \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), + 'customer_id', + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('wishlist', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Wishlist main Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'wishlist_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('wishlist_item') + )->addColumn( + 'wishlist_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Wishlist item ID' + )->addColumn( + 'wishlist_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Wishlist ID' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => true], + 'Store ID' + )->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Add date and time' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Short description of wish list item' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Qty' + )->addIndex( + $installer->getIdxName('wishlist_item', 'wishlist_id'), + 'wishlist_id' + )->addForeignKey( + $installer->getFkName('wishlist_item', 'wishlist_id', 'wishlist', 'wishlist_id'), + 'wishlist_id', + $installer->getTable('wishlist'), + 'wishlist_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addIndex( + $installer->getIdxName('wishlist_item', 'product_id'), + 'product_id' + )->addForeignKey( + $installer->getFkName('wishlist_item', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addIndex( + $installer->getIdxName('wishlist_item', 'store_id'), + 'store_id' + )->addForeignKey( + $installer->getFkName('wishlist_item', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Wishlist items' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'wishlist_item_option' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('wishlist_item_option') + )->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Id' + )->addColumn( + 'wishlist_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Wishlist Item Id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Product Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Code' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Value' + )->addForeignKey( + $installer->getFkName('wishlist_item_option', 'wishlist_item_id', 'wishlist_item', 'wishlist_item_id'), + 'wishlist_item_id', + $installer->getTable('wishlist_item'), + 'wishlist_item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Wishlist Item Option Table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } +} \ No newline at end of file From 1a392c0f524c64df9d4bd05cf751e39200ea3086 Mon Sep 17 00:00:00 2001 From: Maddy Chellathurai Date: Thu, 12 Feb 2015 15:32:15 -0600 Subject: [PATCH 031/106] MAGETWO-33889: Convert CE schema and data scripts to SPI classes - fixing build error due to missing namespace --- app/code/Magento/Sales/Setup/UpgradeSchema.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php index 229c42f987cd4..a486f65a8b0dd 100644 --- a/app/code/Magento/Sales/Setup/UpgradeSchema.php +++ b/app/code/Magento/Sales/Setup/UpgradeSchema.php @@ -8,6 +8,7 @@ namespace Magento\Sales\Setup; +use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleSchemaResourceInterface; From fdbff37bbea5aa09b2546321678622657d3d3117 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Fri, 13 Feb 2015 12:05:00 -0600 Subject: [PATCH 032/106] MAGETWO-33887: Create SPI interfaces and context class - removed usage of ModuleSchemaResourceInterface --- app/code/Magento/AdminNotification/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Authorization/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Bundle/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Captcha/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Catalog/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Catalog/Setup/UpgradeSchema.php | 4 ++-- app/code/Magento/CatalogInventory/Setup/InstallSchema.php | 4 ++-- app/code/Magento/CatalogRule/Setup/InstallSchema.php | 4 ++-- app/code/Magento/CatalogSearch/Setup/InstallSchema.php | 4 ++-- app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php | 4 ++-- app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Cms/Setup/InstallSchema.php | 4 ++-- .../Magento/ConfigurableProduct/Setup/InstallSchema.php | 4 ++-- .../Magento/ConfigurableProduct/Setup/UpgradeSchema.php | 4 ++-- app/code/Magento/Core/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Cron/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Customer/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Customer/Setup/UpgradeSchema.php | 4 ++-- app/code/Magento/DesignEditor/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Directory/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Downloadable/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Eav/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Email/Setup/InstallSchema.php | 4 ++-- app/code/Magento/GiftMessage/Setup/InstallSchema.php | 4 ++-- app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php | 4 ++-- app/code/Magento/GoogleShopping/Setup/InstallSchema.php | 4 ++-- app/code/Magento/ImportExport/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Indexer/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Integration/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Log/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Newsletter/Setup/InstallSchema.php | 4 ++-- app/code/Magento/OfflineShipping/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Persistent/Setup/InstallSchema.php | 4 ++-- app/code/Magento/ProductAlert/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Quote/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Reports/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Review/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Sales/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Sales/Setup/UpgradeSchema.php | 4 ++-- app/code/Magento/SalesRule/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Search/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Sendfriend/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Sitemap/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Store/Setup/InstallSchema.php | 5 +++-- app/code/Magento/Tax/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Theme/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Theme/Setup/UpgradeSchema.php | 4 ++-- app/code/Magento/Translation/Setup/InstallSchema.php | 4 ++-- app/code/Magento/UrlRewrite/Setup/InstallSchema.php | 4 ++-- app/code/Magento/User/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Weee/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Weee/Setup/UpgradeSchema.php | 4 ++-- app/code/Magento/Widget/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Wishlist/Setup/InstallSchema.php | 4 ++-- .../Magento/Framework/Setup/InstallSchemaInterface.php | 5 +++-- lib/internal/Magento/Framework/Setup/README.md | 4 +--- .../Magento/Framework/Setup/UpgradeSchemaInterface.php | 6 +++--- 57 files changed, 116 insertions(+), 116 deletions(-) diff --git a/app/code/Magento/AdminNotification/Setup/InstallSchema.php b/app/code/Magento/AdminNotification/Setup/InstallSchema.php index 223635baaefb2..a604913d43d48 100644 --- a/app/code/Magento/AdminNotification/Setup/InstallSchema.php +++ b/app/code/Magento/AdminNotification/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Authorization/Setup/InstallSchema.php b/app/code/Magento/Authorization/Setup/InstallSchema.php index 65333a2216742..0640078758bc6 100644 --- a/app/code/Magento/Authorization/Setup/InstallSchema.php +++ b/app/code/Magento/Authorization/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php index ab16cc99fa89d..60691c4c75ac8 100644 --- a/app/code/Magento/Bundle/Setup/InstallSchema.php +++ b/app/code/Magento/Bundle/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Captcha/Setup/InstallSchema.php b/app/code/Magento/Captcha/Setup/InstallSchema.php index b42146c02ef14..044d67235a011 100644 --- a/app/code/Magento/Captcha/Setup/InstallSchema.php +++ b/app/code/Magento/Captcha/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php index 9e7442e3ca143..e324335de184e 100644 --- a/app/code/Magento/Catalog/Setup/InstallSchema.php +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index e51913faed7a0..3d6c7b804fa65 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.0.1') <= 0) { $installer = $setup; diff --git a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php index caeee4623a1de..37e33472991a6 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/CatalogRule/Setup/InstallSchema.php b/app/code/Magento/CatalogRule/Setup/InstallSchema.php index 4d5c22745696a..0dd2affd7d73d 100644 --- a/app/code/Magento/CatalogRule/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogRule/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php index 5d195b2766d11..169db106f8bc1 100644 --- a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php index 03bb041095d64..9fc659cb2b9b4 100644 --- a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php index c036fe277b811..78d8baa9cb781 100644 --- a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php +++ b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Cms/Setup/InstallSchema.php b/app/code/Magento/Cms/Setup/InstallSchema.php index 1c1597dead674..f702f28259a3b 100644 --- a/app/code/Magento/Cms/Setup/InstallSchema.php +++ b/app/code/Magento/Cms/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php index 10191eb0df3ea..e5dfce75f707d 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php index bb6605ff4daa7..2897cf8904db1 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php +++ b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.1') <= 0) { $installer = $setup; diff --git a/app/code/Magento/Core/Setup/InstallSchema.php b/app/code/Magento/Core/Setup/InstallSchema.php index 5ad52a99580e6..60132a9756ae9 100644 --- a/app/code/Magento/Core/Setup/InstallSchema.php +++ b/app/code/Magento/Core/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Cron/Setup/InstallSchema.php b/app/code/Magento/Cron/Setup/InstallSchema.php index 8d0a8c67323ba..caa36fd5fa522 100644 --- a/app/code/Magento/Cron/Setup/InstallSchema.php +++ b/app/code/Magento/Cron/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Customer/Setup/InstallSchema.php b/app/code/Magento/Customer/Setup/InstallSchema.php index 5c2b6d35324a9..12077cd2c31f9 100644 --- a/app/code/Magento/Customer/Setup/InstallSchema.php +++ b/app/code/Magento/Customer/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Customer/Setup/UpgradeSchema.php b/app/code/Magento/Customer/Setup/UpgradeSchema.php index 902e33df30af2..0ab1201b72487 100644 --- a/app/code/Magento/Customer/Setup/UpgradeSchema.php +++ b/app/code/Magento/Customer/Setup/UpgradeSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.0.1') <= 0) { $installer = $setup; diff --git a/app/code/Magento/DesignEditor/Setup/InstallSchema.php b/app/code/Magento/DesignEditor/Setup/InstallSchema.php index b2854774a4d3b..ac70acabd4da1 100644 --- a/app/code/Magento/DesignEditor/Setup/InstallSchema.php +++ b/app/code/Magento/DesignEditor/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Directory/Setup/InstallSchema.php b/app/code/Magento/Directory/Setup/InstallSchema.php index e3c142c96e01f..a7bb92ec593fd 100644 --- a/app/code/Magento/Directory/Setup/InstallSchema.php +++ b/app/code/Magento/Directory/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Downloadable/Setup/InstallSchema.php b/app/code/Magento/Downloadable/Setup/InstallSchema.php index 729f0cc49c2f2..b945611f98d8f 100644 --- a/app/code/Magento/Downloadable/Setup/InstallSchema.php +++ b/app/code/Magento/Downloadable/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Eav/Setup/InstallSchema.php b/app/code/Magento/Eav/Setup/InstallSchema.php index b96a53e8165f5..224a06f6ca36e 100644 --- a/app/code/Magento/Eav/Setup/InstallSchema.php +++ b/app/code/Magento/Eav/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Email/Setup/InstallSchema.php b/app/code/Magento/Email/Setup/InstallSchema.php index 1d03181be4f54..c8f2cded44487 100644 --- a/app/code/Magento/Email/Setup/InstallSchema.php +++ b/app/code/Magento/Email/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/GiftMessage/Setup/InstallSchema.php b/app/code/Magento/GiftMessage/Setup/InstallSchema.php index 99a5c498691ac..444c90a388c29 100644 --- a/app/code/Magento/GiftMessage/Setup/InstallSchema.php +++ b/app/code/Magento/GiftMessage/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php index c86102f23eb97..ef002e6678ac7 100644 --- a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php +++ b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/GoogleShopping/Setup/InstallSchema.php b/app/code/Magento/GoogleShopping/Setup/InstallSchema.php index 2d03fcb2b7ac9..1d2d38ebffa14 100644 --- a/app/code/Magento/GoogleShopping/Setup/InstallSchema.php +++ b/app/code/Magento/GoogleShopping/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/ImportExport/Setup/InstallSchema.php b/app/code/Magento/ImportExport/Setup/InstallSchema.php index 453b7041a7145..ad0e57b8efeea 100644 --- a/app/code/Magento/ImportExport/Setup/InstallSchema.php +++ b/app/code/Magento/ImportExport/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Indexer/Setup/InstallSchema.php b/app/code/Magento/Indexer/Setup/InstallSchema.php index 30fd4a40e76d6..dd44f594b6f34 100644 --- a/app/code/Magento/Indexer/Setup/InstallSchema.php +++ b/app/code/Magento/Indexer/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Integration/Setup/InstallSchema.php b/app/code/Magento/Integration/Setup/InstallSchema.php index 34760c4917ce4..a339e6571e9e9 100644 --- a/app/code/Magento/Integration/Setup/InstallSchema.php +++ b/app/code/Magento/Integration/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Log/Setup/InstallSchema.php b/app/code/Magento/Log/Setup/InstallSchema.php index f5266192c2b28..6639baf7961fb 100644 --- a/app/code/Magento/Log/Setup/InstallSchema.php +++ b/app/code/Magento/Log/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Newsletter/Setup/InstallSchema.php b/app/code/Magento/Newsletter/Setup/InstallSchema.php index b6c395e66be7a..4026beb2cebea 100644 --- a/app/code/Magento/Newsletter/Setup/InstallSchema.php +++ b/app/code/Magento/Newsletter/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/OfflineShipping/Setup/InstallSchema.php b/app/code/Magento/OfflineShipping/Setup/InstallSchema.php index 0928929855221..611323f0b736c 100644 --- a/app/code/Magento/OfflineShipping/Setup/InstallSchema.php +++ b/app/code/Magento/OfflineShipping/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Persistent/Setup/InstallSchema.php b/app/code/Magento/Persistent/Setup/InstallSchema.php index 297d52c2e34e6..ff015684db928 100644 --- a/app/code/Magento/Persistent/Setup/InstallSchema.php +++ b/app/code/Magento/Persistent/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/ProductAlert/Setup/InstallSchema.php b/app/code/Magento/ProductAlert/Setup/InstallSchema.php index 05e7a826bcd39..fa114dabd37fb 100644 --- a/app/code/Magento/ProductAlert/Setup/InstallSchema.php +++ b/app/code/Magento/ProductAlert/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Quote/Setup/InstallSchema.php b/app/code/Magento/Quote/Setup/InstallSchema.php index 2c65eeeaa81e6..04d10e246541c 100644 --- a/app/code/Magento/Quote/Setup/InstallSchema.php +++ b/app/code/Magento/Quote/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Reports/Setup/InstallSchema.php b/app/code/Magento/Reports/Setup/InstallSchema.php index 16f4c0b5d9f56..9875c61a51c29 100644 --- a/app/code/Magento/Reports/Setup/InstallSchema.php +++ b/app/code/Magento/Reports/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; /* diff --git a/app/code/Magento/Review/Setup/InstallSchema.php b/app/code/Magento/Review/Setup/InstallSchema.php index 1e34e71c1edab..92e3198a71ceb 100644 --- a/app/code/Magento/Review/Setup/InstallSchema.php +++ b/app/code/Magento/Review/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Sales/Setup/InstallSchema.php b/app/code/Magento/Sales/Setup/InstallSchema.php index 5a54af0f3b992..c2989af5bcc6a 100644 --- a/app/code/Magento/Sales/Setup/InstallSchema.php +++ b/app/code/Magento/Sales/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php index a486f65a8b0dd..9b1b8fa1a5b9b 100644 --- a/app/code/Magento/Sales/Setup/UpgradeSchema.php +++ b/app/code/Magento/Sales/Setup/UpgradeSchema.php @@ -11,14 +11,14 @@ use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.1') <= 0) { diff --git a/app/code/Magento/SalesRule/Setup/InstallSchema.php b/app/code/Magento/SalesRule/Setup/InstallSchema.php index 304b7b20c885d..743d0d425353e 100644 --- a/app/code/Magento/SalesRule/Setup/InstallSchema.php +++ b/app/code/Magento/SalesRule/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Search/Setup/InstallSchema.php b/app/code/Magento/Search/Setup/InstallSchema.php index 91f9833679d2d..e5e349c5f31ff 100644 --- a/app/code/Magento/Search/Setup/InstallSchema.php +++ b/app/code/Magento/Search/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Sendfriend/Setup/InstallSchema.php b/app/code/Magento/Sendfriend/Setup/InstallSchema.php index 9a41215aee0e1..c46948250cbf1 100644 --- a/app/code/Magento/Sendfriend/Setup/InstallSchema.php +++ b/app/code/Magento/Sendfriend/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Sitemap/Setup/InstallSchema.php b/app/code/Magento/Sitemap/Setup/InstallSchema.php index 6ac3750e2f5bf..29c7c8d5cdcb1 100644 --- a/app/code/Magento/Sitemap/Setup/InstallSchema.php +++ b/app/code/Magento/Sitemap/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Store/Setup/InstallSchema.php b/app/code/Magento/Store/Setup/InstallSchema.php index ac1f9a3882d6e..0d49eb4b4b236 100644 --- a/app/code/Magento/Store/Setup/InstallSchema.php +++ b/app/code/Magento/Store/Setup/InstallSchema.php @@ -10,14 +10,15 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; +use \Magento\Framework\DB\Ddl\Table; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Tax/Setup/InstallSchema.php b/app/code/Magento/Tax/Setup/InstallSchema.php index f07089f37527e..020a096c41aa7 100644 --- a/app/code/Magento/Tax/Setup/InstallSchema.php +++ b/app/code/Magento/Tax/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); diff --git a/app/code/Magento/Theme/Setup/InstallSchema.php b/app/code/Magento/Theme/Setup/InstallSchema.php index 89e5325984e5c..635d0c059ab77 100644 --- a/app/code/Magento/Theme/Setup/InstallSchema.php +++ b/app/code/Magento/Theme/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Theme/Setup/UpgradeSchema.php b/app/code/Magento/Theme/Setup/UpgradeSchema.php index 5201ef7287370..18f4d20d57505 100644 --- a/app/code/Magento/Theme/Setup/UpgradeSchema.php +++ b/app/code/Magento/Theme/Setup/UpgradeSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.1') <= 0) { $installer = $setup; diff --git a/app/code/Magento/Translation/Setup/InstallSchema.php b/app/code/Magento/Translation/Setup/InstallSchema.php index 489313d62544a..c402cb98ed263 100644 --- a/app/code/Magento/Translation/Setup/InstallSchema.php +++ b/app/code/Magento/Translation/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/UrlRewrite/Setup/InstallSchema.php b/app/code/Magento/UrlRewrite/Setup/InstallSchema.php index 118fad1e85619..269ae86f46bc7 100644 --- a/app/code/Magento/UrlRewrite/Setup/InstallSchema.php +++ b/app/code/Magento/UrlRewrite/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/User/Setup/InstallSchema.php b/app/code/Magento/User/Setup/InstallSchema.php index 7c6365c890878..0caa98e152540 100644 --- a/app/code/Magento/User/Setup/InstallSchema.php +++ b/app/code/Magento/User/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Weee/Setup/InstallSchema.php b/app/code/Magento/Weee/Setup/InstallSchema.php index f52df2f9d27e3..7b1cbac4e6a64 100644 --- a/app/code/Magento/Weee/Setup/InstallSchema.php +++ b/app/code/Magento/Weee/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); /** diff --git a/app/code/Magento/Weee/Setup/UpgradeSchema.php b/app/code/Magento/Weee/Setup/UpgradeSchema.php index d59fd2c06c16e..bdf118e1249a7 100644 --- a/app/code/Magento/Weee/Setup/UpgradeSchema.php +++ b/app/code/Magento/Weee/Setup/UpgradeSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.0.1') <= 0) { $setup->startSetup(); diff --git a/app/code/Magento/Widget/Setup/InstallSchema.php b/app/code/Magento/Widget/Setup/InstallSchema.php index c6026bd255d41..942ba028afb69 100644 --- a/app/code/Magento/Widget/Setup/InstallSchema.php +++ b/app/code/Magento/Widget/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Wishlist/Setup/InstallSchema.php b/app/code/Magento/Wishlist/Setup/InstallSchema.php index 97bea7c814f92..1b5452569891d 100644 --- a/app/code/Magento/Wishlist/Setup/InstallSchema.php +++ b/app/code/Magento/Wishlist/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\SchemaResourceInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/lib/internal/Magento/Framework/Setup/InstallSchemaInterface.php b/lib/internal/Magento/Framework/Setup/InstallSchemaInterface.php index 402039e3ebf4a..291009afcd710 100644 --- a/lib/internal/Magento/Framework/Setup/InstallSchemaInterface.php +++ b/lib/internal/Magento/Framework/Setup/InstallSchemaInterface.php @@ -13,8 +13,9 @@ interface InstallSchemaInterface /** * Installs DB schema for a module * - * @param ModuleSchemaResourceInterface $setup + * @param SchemaResourceInterface $setup * @param ModuleContextInterface $context + * @return void */ - public function install(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context); + public function install(SchemaResourceInterface $setup, ModuleContextInterface $context); } diff --git a/lib/internal/Magento/Framework/Setup/README.md b/lib/internal/Magento/Framework/Setup/README.md index 243b08f57ee4f..3a6ec2dc0b865 100644 --- a/lib/internal/Magento/Framework/Setup/README.md +++ b/lib/internal/Magento/Framework/Setup/README.md @@ -3,6 +3,4 @@ Implement `InstallSchemaInterface` and/or `UpgradeSchemaInterface` for DB schema install and/or upgrade. Implement `InstallDataInterface` and/or `UpgradeDataInterface` for DB data install and/or upgrade. -Setup application provides concrete implementation of a module context and setup DB/schema resources. -Additionally, you may implement `ModuleSchemaResourceInterface` or `ModuleDataResourceInterface`, if your module -requires custom setup resources. +Setup application provides concrete implementation of a module context and setup DB/schema resources, so they can be used to determine current state of the module and get access to DB resource. diff --git a/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php b/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php index 71695c1117361..6c968cdd01a3e 100644 --- a/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php +++ b/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php @@ -13,9 +13,9 @@ interface UpgradeSchemaInterface /** * Upgrades DB schema for a module * - * @param ModuleSchemaResourceInterface $setup + * @param SchemaResourceInterface $setup * @param ModuleContextInterface $context - * @return void + * @return */ - public function upgrade(ModuleSchemaResourceInterface $setup, ModuleContextInterface $context); + public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context); } From e794312ff95e7f6b94155b38fc114ca7279a48e6 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Fri, 13 Feb 2015 12:19:41 -0600 Subject: [PATCH 033/106] MAGETWO-33889: Convert CE schema and data scripts to SPI classes - removed old scripts --- .../adminnotification_setup/install-2.0.0.php | 112 - .../sql/authorization_setup/install-2.0.0.php | 133 - .../Bundle/sql/bundle_setup/install-2.0.0.php | 1008 ---- .../sql/captcha_setup/install-2.0.0.php | 43 - .../sql/catalog_setup/install-2.0.0.php | 4536 --------------- .../catalog_setup/upgrade-2.0.0-2.0.0.1.php | 35 - .../cataloginventory_setup/install-2.0.0.php | 440 -- .../catalogrule_setup/data-install-2.0.0.php | 28 - .../sql/catalogrule_setup/install-2.0.0.php | 513 -- .../sql/catalogsearch_setup/install-2.0.0.php | 71 - .../catalogurlrewrite_setup/install-2.0.0.php | 67 - .../install-2.0.0.php | 99 - .../Cms/sql/cms_setup/install-2.0.0.php | 263 - .../install-2.0.0.php | 300 - .../upgrade-2.0.0-2.0.1.php | 19 - .../data/core_setup/data-install-2.0.0.php | 35 - .../Core/sql/core_setup/install-2.0.0.php | 475 -- .../Cron/sql/cron_setup/install-2.0.0.php | 76 - .../sql/customer_setup/install-2.0.0.php | 1182 ---- .../customer_setup/upgrade-2.0.0-2.0.0.1.php | 44 - .../sql/designeditor_setup/install-2.0.0.php | 49 - .../sql/directory_setup/install-2.0.0.php | 188 - .../sql/downloadable_setup/install-2.0.0.php | 710 --- .../Eav/sql/eav_setup/install-2.0.0.php | 1434 ----- .../Email/sql/email_setup/install-2.0.0.php | 105 - .../data/fedex_setup/data-install-2.0.0.php | 91 - .../sql/giftmessage_setup/install-2.0.0.php | 52 - .../googleoptimizer_setup/install-2.0.0.php | 74 - .../googleshopping_setup/install-2.0.0.php | 179 - .../sql/importexport_setup/install-2.0.0.php | 47 - .../sql/indexer_setup/install-2.0.0.php | 115 - .../sql/integration_setup/install-2.0.0.php | 356 -- .../data/log_setup/data-install-1.6.0.0.php | 17 - .../Log/sql/log_setup/install-2.0.0.php | 387 -- .../sql/newsletter_setup/install-2.0.0.php | 455 -- .../offlineshipping_setup/install-2.0.0.php | 125 - .../sql/persistent_setup/install-2.0.0.php | 96 - .../sql/productalert_setup/install-2.0.0.php | 199 - .../Quote/sql/quote_setup/install-2.0.0.php | 1534 ----- .../sql/reports_setup/install-2.0.0.php | 855 --- .../data/review_setup/data-install-2.0.0.php | 65 - .../Review/sql/review_setup/install-2.0.0.php | 750 --- .../Sales/sql/sales_setup/install-2.0.0.php | 5157 ----------------- .../sql/sales_setup/upgrade-2.0.0-2.0.1.php | 45 - .../salesrule_setup/data-install-2.0.0.php | 28 - .../sql/salesrule_setup/install-2.0.0.php | 781 --- .../Search/sql/search_setup/install-2.0.0.php | 117 - .../sql/sendfriend_setup/install-2.0.0.php | 49 - .../sql/sitemap_setup/install-2.0.0.php | 69 - .../Store/sql/store_setup/install-2.0.0.php | 279 - .../Tax/sql/tax_setup/install-2.0.0.php | 500 -- .../Theme/sql/theme_setup/install-2.0.0.php | 144 - .../sql/theme_setup/upgrade-2.0.0-2.0.1.php | 21 - .../sql/translation_setup/install-2.0.0.php | 89 - .../sql/urlrewrite_setup/install-2.0.0.php | 107 - .../User/sql/user_setup/install-2.0.0.php | 127 - .../data/usps_setup/data-install-2.0.0.php | 84 - .../Weee/sql/weee_setup/install-2.0.0.php | 107 - .../sql/weee_setup/upgrade-2.0.0-2.0.0.1.php | 15 - .../data/widget_setup/data-install-2.0.0.php | 20 - .../Widget/sql/widget_setup/install-2.0.0.php | 276 - .../sql/wishlist_setup/install-2.0.0.php | 197 - 62 files changed, 25574 deletions(-) delete mode 100644 app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Bundle/sql/bundle_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-2.0.0-2.0.0.1.php delete mode 100644 app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-2.0.0.php delete mode 100644 app/code/Magento/CatalogRule/data/catalogrule_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/CatalogRule/sql/catalogrule_setup/install-2.0.0.php delete mode 100644 app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-2.0.0.php delete mode 100644 app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-2.0.0.php delete mode 100644 app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php delete mode 100644 app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.0.php delete mode 100644 app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/upgrade-2.0.0-2.0.1.php delete mode 100644 app/code/Magento/Core/data/core_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Core/sql/core_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php delete mode 100644 app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Downloadable/sql/downloadable_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Email/sql/email_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php delete mode 100644 app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.php delete mode 100644 app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-2.0.0.php delete mode 100644 app/code/Magento/ImportExport/sql/importexport_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Indexer/sql/indexer_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php delete mode 100644 app/code/Magento/Log/sql/log_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Newsletter/sql/newsletter_setup/install-2.0.0.php delete mode 100644 app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php delete mode 100644 app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Quote/sql/quote_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Reports/sql/reports_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Review/data/review_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Review/sql/review_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Sales/sql/sales_setup/upgrade-2.0.0-2.0.1.php delete mode 100644 app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Search/sql/search_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Store/sql/store_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php delete mode 100644 app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php delete mode 100644 app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-2.0.0.php delete mode 100644 app/code/Magento/User/sql/user_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php delete mode 100644 app/code/Magento/Widget/data/widget_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php diff --git a/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php b/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php deleted file mode 100644 index b602490e32a78..0000000000000 --- a/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-2.0.0.php +++ /dev/null @@ -1,112 +0,0 @@ - - */ - -/** @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ -$installer = $this; - -$installer->startSetup(); -/** - * Create table 'adminnotification_inbox' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('adminnotification_inbox') -)->addColumn( - 'notification_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Notification id' -)->addColumn( - 'severity', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Problem type' -)->addColumn( - 'date_added', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Create date' -)->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Title' -)->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' -)->addColumn( - 'url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Url' -)->addColumn( - 'is_read', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Flag if notification read' -)->addColumn( - 'is_remove', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Flag if notification might be removed' -)->addIndex( - $installer->getIdxName('adminnotification_inbox', ['severity']), - ['severity'] -)->addIndex( - $installer->getIdxName('adminnotification_inbox', ['is_read']), - ['is_read'] -)->addIndex( - $installer->getIdxName('adminnotification_inbox', ['is_remove']), - ['is_remove'] -)->setComment( - 'Adminnotification Inbox' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'admin_system_messages' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('admin_system_messages') -)->addColumn( - 'identity', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['nullable' => false, 'primary' => true], - 'Message id' -)->addColumn( - 'severity', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Problem type' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Create date' -)->setComment( - 'Admin System Messages' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php b/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php deleted file mode 100644 index 2ae09848561c4..0000000000000 --- a/app/code/Magento/Authorization/sql/authorization_setup/install-2.0.0.php +++ /dev/null @@ -1,133 +0,0 @@ -startSetup(); - -if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_role'))) { - /** - * Create table 'authorization_role' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('authorization_role') - )->addColumn( - 'role_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Role ID' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Parent Role ID' - )->addColumn( - 'tree_level', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Role Tree Level' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Role Sort Order' - )->addColumn( - 'role_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 1, - ['nullable' => false, 'default' => '0'], - 'Role Type' - )->addColumn( - 'user_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'User ID' - )->addColumn( - 'user_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['nullable' => true, 'default' => null], - 'User Type' - )->addColumn( - 'role_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => true, 'default' => null], - 'Role Name' - )->addIndex( - $installer->getIdxName('authorization_role', ['parent_id', 'sort_order']), - ['parent_id', 'sort_order'] - )->addIndex( - $installer->getIdxName('authorization_role', ['tree_level']), - ['tree_level'] - )->setComment( - 'Admin Role Table' - ); - $installer->getConnection()->createTable($table); -} - -if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_rule'))) { - /** - * Create table 'authorization_rule' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('authorization_rule') - )->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule ID' - )->addColumn( - 'role_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Role ID' - )->addColumn( - 'resource_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Resource ID' - )->addColumn( - 'privileges', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - ['nullable' => true], - 'Privileges' - )->addColumn( - 'permission', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 10, - [], - 'Permission' - )->addIndex( - $installer->getIdxName('authorization_rule', ['resource_id', 'role_id']), - ['resource_id', 'role_id'] - )->addIndex( - $installer->getIdxName('authorization_rule', ['role_id', 'resource_id']), - ['role_id', 'resource_id'] - )->addForeignKey( - $installer->getFkName('authorization_rule', 'role_id', 'authorization_role', 'role_id'), - 'role_id', - $installer->getTable('authorization_role'), - 'role_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Admin Rule Table' - ); - $installer->getConnection()->createTable($table); -} - -$installer->endSetup(); diff --git a/app/code/Magento/Bundle/sql/bundle_setup/install-2.0.0.php b/app/code/Magento/Bundle/sql/bundle_setup/install-2.0.0.php deleted file mode 100644 index c1149834591e5..0000000000000 --- a/app/code/Magento/Bundle/sql/bundle_setup/install-2.0.0.php +++ /dev/null @@ -1,1008 +0,0 @@ -startSetup(); - -/** - * Create table 'catalog_product_bundle_option' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_bundle_option')) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Id' - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - ) - ->addColumn( - 'required', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Required' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Position' - ) - ->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Type' - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_option', ['parent_id']), - ['parent_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_bundle_option', 'parent_id', 'catalog_product_entity', 'entity_id'), - 'parent_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Bundle Option'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_bundle_option_value' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_bundle_option_value')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Option Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Title' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_bundle_option_value', - ['option_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['option_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_bundle_option_value', - 'option_id', - 'catalog_product_bundle_option', - 'option_id' - ), - 'option_id', - $installer->getTable('catalog_product_bundle_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Bundle Option Value'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_bundle_selection' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_bundle_selection')) - ->addColumn( - 'selection_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Selection Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Option Id' - ) - ->addColumn( - 'parent_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Product Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Product Id' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Position' - ) - ->addColumn( - 'is_default', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Default' - ) - ->addColumn( - 'selection_price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Selection Price Type' - ) - ->addColumn( - 'selection_price_value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Selection Price Value' - ) - ->addColumn( - 'selection_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Selection Qty' - ) - ->addColumn( - 'selection_can_change_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Selection Can Change Qty' - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_selection', ['option_id']), - ['option_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_selection', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_bundle_selection', - 'option_id', - 'catalog_product_bundle_option', - 'option_id' - ), - 'option_id', - $installer->getTable('catalog_product_bundle_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_bundle_selection', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Bundle Selection'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_bundle_selection_price' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_bundle_selection_price')) - ->addColumn( - 'selection_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Selection Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'selection_price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Selection Price Type' - ) - ->addColumn( - 'selection_price_value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Selection Price Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_selection_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_bundle_selection_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_bundle_selection_price', - 'selection_id', - 'catalog_product_bundle_selection', - 'selection_id' - ), - 'selection_id', - $installer->getTable('catalog_product_bundle_selection'), - 'selection_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Bundle Selection Price'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_bundle_price_index' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_bundle_price_index')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Max Price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_price_index', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_price_index', ['customer_group_id']), - ['customer_group_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_bundle_price_index', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_bundle_price_index', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_bundle_price_index', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Bundle Price Index'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_bundle_stock_index' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_bundle_stock_index') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Stock Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option Id' - ) - ->addColumn( - 'stock_status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['default' => '0'], - 'Stock Status' - ) - ->setComment('Catalog Product Bundle Stock Index'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_bundle_idx' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_idx')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class Id' - ) - ->addColumn( - 'price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Price Type' - ) - ->addColumn( - 'special_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Special Price' - ) - ->addColumn( - 'tier_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Percent' - ) - ->addColumn( - 'orig_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Orig Price' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'base_tier', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tier' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) - ->addColumn( - 'group_price_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group Price Percent' - ) - ->setComment('Catalog Product Index Price Bundle Idx'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_bundle_tmp' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_tmp')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class Id' - ) - ->addColumn( - 'price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Price Type' - ) - ->addColumn( - 'special_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Special Price' - ) - ->addColumn( - 'tier_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Percent' - ) - ->addColumn( - 'orig_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Orig Price' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'base_tier', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tier' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) - ->addColumn( - 'group_price_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group Price Percent' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment('Catalog Product Index Price Bundle Tmp'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_bundle_sel_idx' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_sel_idx')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option Id' - ) - ->addColumn( - 'selection_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Selection Id' - ) - ->addColumn( - 'group_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Group Type' - ) - ->addColumn( - 'is_required', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Is Required' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setComment('Catalog Product Index Price Bundle Sel Idx'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_bundle_sel_tmp' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_sel_tmp')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option Id' - ) - ->addColumn( - 'selection_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Selection Id' - ) - ->addColumn( - 'group_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Group Type' - ) - ->addColumn( - 'is_required', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Is Required' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment('Catalog Product Index Price Bundle Sel Tmp'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_bundle_opt_idx' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_opt_idx')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option Id' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'alt_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'alt_tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'alt_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Group Price' - ) - ->setComment('Catalog Product Index Price Bundle Opt Idx'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_bundle_opt_tmp' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_opt_tmp')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option Id' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'alt_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'alt_tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'alt_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Group Price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment('Catalog Product Index Price Bundle Opt Tmp'); - -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php b/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php deleted file mode 100644 index 327b2963c6745..0000000000000 --- a/app/code/Magento/Captcha/sql/captcha_setup/install-2.0.0.php +++ /dev/null @@ -1,43 +0,0 @@ -startSetup(); - -$table = $installer->getConnection()->newTable( - $installer->getTable('captcha_log') -)->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Type' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'unsigned' => true, 'primary' => true], - 'Value' -)->addColumn( - 'count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Count' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Update Time' -)->setComment( - 'Count Login Attempts' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php b/app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php deleted file mode 100644 index e526ec647d9ea..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php +++ /dev/null @@ -1,4536 +0,0 @@ -startSetup(); - -/** - * Create table 'catalog_product_entity' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'default' => 'simple'], - 'Type ID' - ) - ->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - [], - 'SKU' - ) - ->addColumn( - 'has_options', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Has Options' - ) - ->addColumn( - 'required_options', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Required Options' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Creation Time' - ) - ->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - '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'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity', ['sku']), - ['sku'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), - 'attribute_set_id', - $installer->getTable('eav_attribute_set'), - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_datetime' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_datetime')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_datetime', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_datetime', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_datetime', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Datetime Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_decimal' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_decimal')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_decimal', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_decimal', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_decimal', ['attribute_id']), - ['attribute_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Decimal Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_int' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_int')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_int', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_int', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_int', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_int', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_int', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Integer Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_text' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_text')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_text', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_text', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_text', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_text', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_text', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Text Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_varchar' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_varchar')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_varchar', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_varchar', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_varchar', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Varchar Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_gallery' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_gallery')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Position' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_gallery', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_gallery', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_gallery', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_gallery', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Gallery Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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'], - 'Attriute Set ID' - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Parent Category ID' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Creation Time' - ) - ->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Update Time' - ) - ->addColumn( - 'path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Tree Path' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Position' - ) - ->addColumn( - 'level', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Tree Level' - ) - ->addColumn( - 'children_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Child Count' - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity', ['level']), - ['level'] - ) - ->setComment('Catalog Category Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity_datetime' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity_datetime')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_entity_datetime', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_datetime', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_datetime', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_datetime', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Category Datetime Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity_decimal' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity_decimal')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_entity_decimal', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_decimal', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_decimal', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_decimal', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Category Decimal Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity_int' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity_int')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_entity_int', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_int', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_int', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_int', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_int', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_int', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Category Integer Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity_text' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity_text')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_entity_text', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_text', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_text', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_text', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_text', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_text', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Category Text Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity_varchar' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity_varchar')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_entity_varchar', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_varchar', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_varchar', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_varchar', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Category Varchar Attribute Backend Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_product' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_product')) - ->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( - $installer->getIdxName('catalog_category_product', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_product', 'category_id', 'catalog_category_entity', 'entity_id'), - 'category_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_product', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product To Category Linkage Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_product_index' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_product_index')) - ->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, - ['unsigned' => false, 'nullable' => true, 'default' => null], - 'Position' - ) - ->addColumn( - 'is_parent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Parent' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'visibility', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Visibility' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_product_index', - ['product_id', 'store_id', 'category_id', 'visibility'] - ), - ['product_id', 'store_id', 'category_id', 'visibility'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_product_index', - ['store_id', 'category_id', 'visibility', 'is_parent', 'position'] - ), - ['store_id', 'category_id', 'visibility', 'is_parent', 'position'] - ) - ->setComment('Catalog Category Product Index'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_compare_item' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_compare_item') - ) - ->addColumn( - 'catalog_compare_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Compare Item ID' - ) - ->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Visitor ID' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store ID' - ) - ->addIndex( - $installer->getIdxName('catalog_compare_item', ['product_id']), - ['product_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_compare_item', ['visitor_id', 'product_id']), - ['visitor_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_compare_item', ['customer_id', 'product_id']), - ['customer_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_compare_item', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_compare_item', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_compare_item', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_compare_item', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Compare Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_website' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_website') - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addIndex( - $installer->getIdxName('catalog_product_website', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_website', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product To Website Linkage Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_link_type' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link_type') - ) - ->addColumn( - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Link Type ID' - ) - ->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true, 'default' => null], - 'Code' - ) - ->setComment( - 'Catalog Product Link Type Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_link' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link') - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Link ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'linked_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Linked Product ID' - ) - ->addColumn( - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Link Type ID' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_link', - ['link_type_id', 'product_id', 'linked_product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['link_type_id', 'product_id', 'linked_product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_link', ['product_id']), - ['product_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_link', ['linked_product_id']), - ['linked_product_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link', 'linked_product_id', 'catalog_product_entity', 'entity_id'), - 'linked_product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link', 'link_type_id', 'catalog_product_link_type', 'link_type_id'), - 'link_type_id', - $installer->getTable('catalog_product_link_type'), - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product To Product Linkage Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_link_attribute' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link_attribute') - ) - ->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Link Attribute ID' - ) - ->addColumn( - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Link Type ID' - ) - ->addColumn( - 'product_link_attribute_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true, 'default' => null], - 'Product Link Attribute Code' - ) - ->addColumn( - 'data_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true, 'default' => null], - 'Data Type' - ) - ->addIndex( - $installer->getIdxName('catalog_product_link_attribute', ['link_type_id']), - ['link_type_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute', - 'link_type_id', - 'catalog_product_link_type', - 'link_type_id' - ), - 'link_type_id', - $installer->getTable('catalog_product_link_type'), - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Link Attribute Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_link_attribute_decimal' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link_attribute_decimal') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Product Link Attribute ID' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Link ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_link_attribute_decimal', ['link_id']), - ['link_id'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_link_attribute_decimal', - ['product_link_attribute_id', 'link_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_link_attribute_id', 'link_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_decimal', 'link_id', 'catalog_product_link', 'link_id'), - 'link_id', - $installer->getTable('catalog_product_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute_decimal', - 'product_link_attribute_id', - 'catalog_product_link_attribute', - 'product_link_attribute_id' - ), - 'product_link_attribute_id', - $installer->getTable('catalog_product_link_attribute'), - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Link Decimal Attribute Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_link_attribute_int' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link_attribute_int') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Product Link Attribute ID' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Link ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_link_attribute_int', ['link_id']), - ['link_id'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_link_attribute_int', - ['product_link_attribute_id', 'link_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_link_attribute_id', 'link_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_int', 'link_id', 'catalog_product_link', 'link_id'), - 'link_id', - $installer->getTable('catalog_product_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute_int', - 'product_link_attribute_id', - 'catalog_product_link_attribute', - 'product_link_attribute_id' - ), - 'product_link_attribute_id', - $installer->getTable('catalog_product_link_attribute'), - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Link Integer Attribute Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_link_attribute_varchar' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link_attribute_varchar') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Link Attribute ID' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Link ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_link_attribute_varchar', ['link_id']), - ['link_id'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_link_attribute_varchar', - ['product_link_attribute_id', 'link_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_link_attribute_id', 'link_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_varchar', 'link_id', 'catalog_product_link', 'link_id'), - 'link_id', - $installer->getTable('catalog_product_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute_varchar', - 'product_link_attribute_id', - 'catalog_product_link_attribute', - 'product_link_attribute_id' - ), - 'product_link_attribute_id', - $installer->getTable('catalog_product_link_attribute'), - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Link Varchar Attribute Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_entity_tier_price' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_entity_tier_price') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'all_groups', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Applicable To All Customer Groups' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Group ID' - ) - ->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '1.0000'], - 'QTY' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Website ID' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_tier_price', - ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_tier_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_tier_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_tier_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_tier_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Tier Price Attribute Backend Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_entity_media_gallery' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_entity_media_gallery') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery', ['entity_id']), - ['entity_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_media_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_media_gallery', - 'entity_id', - 'catalog_product_entity', - 'entity_id' - ), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Media Gallery Attribute Backend Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_entity_media_gallery_value' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_entity_media_gallery_value') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Value ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Label' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Position' - ) - ->addColumn( - 'disabled', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Disabled' - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery_value', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery_value', ['entity_id']), - ['entity_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_media_gallery_value', - 'value_id', - 'catalog_product_entity_media_gallery', - 'value_id' - ), - 'value_id', - $installer->getTable('catalog_product_entity_media_gallery'), - 'value_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_media_gallery_value', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_media_gallery_value', - 'entity_id', - 'catalog_product_entity', - 'entity_id' - ), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Media Gallery Attribute Value Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_option' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option') - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => true, 'default' => null], - 'Type' - ) - ->addColumn( - 'is_require', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Is Required' - ) - ->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - [], - 'SKU' - ) - ->addColumn( - 'max_characters', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Max Characters' - ) - ->addColumn( - 'file_extension', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'File Extension' - ) - ->addColumn( - 'image_size_x', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Image Size X' - ) - ->addColumn( - 'image_size_y', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Image Size Y' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - ) - ->addIndex( - $installer->getIdxName('catalog_product_option', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_option_price' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option_price') - ) - ->addColumn( - 'option_price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Price ID' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' - ) - ->addColumn( - 'price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 7, - ['nullable' => false, 'default' => 'fixed'], - 'Price Type' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_option_price', - ['option_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['option_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_option_price', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_price', 'option_id', 'catalog_product_option', 'option_id'), - 'option_id', - $installer->getTable('catalog_product_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_price', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Price Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_option_title' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option_title') - ) - ->addColumn( - 'option_title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Title ID' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Title' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_option_title', - ['option_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['option_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_option_title', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_title', 'option_id', 'catalog_product_option', 'option_id'), - 'option_id', - $installer->getTable('catalog_product_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Title Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_option_type_value' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option_type_value') - ) - ->addColumn( - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Type ID' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option ID' - ) - ->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - [], - 'SKU' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - ) - ->addIndex( - $installer->getIdxName('catalog_product_option_type_value', ['option_id']), - ['option_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_type_value', 'option_id', 'catalog_product_option', 'option_id'), - 'option_id', - $installer->getTable('catalog_product_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Type Value Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_option_type_price' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option_type_price') - ) - ->addColumn( - 'option_type_price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Type Price ID' - ) - ->addColumn( - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option Type ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' - ) - ->addColumn( - 'price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 7, - ['nullable' => false, 'default' => 'fixed'], - 'Price Type' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_option_type_price', - ['option_type_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['option_type_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_option_type_price', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_option_type_price', - 'option_type_id', - 'catalog_product_option_type_value', - 'option_type_id' - ), - 'option_type_id', - $installer->getTable('catalog_product_option_type_value'), - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_type_price', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Type Price Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_option_type_title' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option_type_title') - ) - ->addColumn( - 'option_type_title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Type Title ID' - ) - ->addColumn( - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option Type ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Title' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_option_type_title', - ['option_type_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['option_type_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_option_type_title', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_option_type_title', - 'option_type_id', - 'catalog_product_option_type_value', - 'option_type_id' - ), - 'option_type_id', - $installer->getTable('catalog_product_option_type_value'), - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_type_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Type Title Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_eav_attribute' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_eav_attribute') - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'frontend_input_renderer', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Frontend Input Renderer' - ) - ->addColumn( - 'is_global', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Global' - ) - ->addColumn( - 'is_visible', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Visible' - ) - ->addColumn( - 'is_searchable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Searchable' - ) - ->addColumn( - 'is_filterable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Filterable' - ) - ->addColumn( - 'is_comparable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Comparable' - ) - ->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible On Front' - ) - ->addColumn( - 'is_html_allowed_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is HTML Allowed On Front' - ) - ->addColumn( - 'is_used_for_price_rules', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Used For Price Rules' - ) - ->addColumn( - 'is_filterable_in_search', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Filterable In Search' - ) - ->addColumn( - 'used_in_product_listing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Used In Product Listing' - ) - ->addColumn( - 'used_for_sort_by', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Used For Sorting' - ) - ->addColumn( - 'apply_to', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Apply To' - ) - ->addColumn( - 'is_visible_in_advanced_search', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible In Advanced Search' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Position' - ) - ->addColumn( - 'is_wysiwyg_enabled', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is WYSIWYG Enabled' - ) - ->addColumn( - 'is_used_for_promo_rules', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Used For Promo Rules' - ) - ->addColumn( - 'is_required_in_admin_store', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Required In Admin Store' - ) - ->addIndex( - $installer->getIdxName('catalog_eav_attribute', ['used_for_sort_by']), - ['used_for_sort_by'] - ) - ->addIndex( - $installer->getIdxName('catalog_eav_attribute', ['used_in_product_listing']), - ['used_in_product_listing'] - ) - ->addForeignKey( - $installer->getFkName('catalog_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog EAV Attribute Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_relation' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_relation') - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Parent ID' - ) - ->addColumn( - 'child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Child ID' - ) - ->addIndex( - $installer->getIdxName('catalog_product_relation', ['child_id']), - ['child_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_relation', 'child_id', 'catalog_product_entity', 'entity_id'), - 'child_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_relation', 'parent_id', 'catalog_product_entity', 'entity_id'), - 'parent_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Relation Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_eav' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav', ['value']), - ['value'] - ) - ->setComment( - 'Catalog Product EAV Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_eav_decimal' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav_decimal') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'primary' => false], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal', ['value']), - ['value'] - ) - ->setComment( - 'Catalog Product EAV Decimal Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'final_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Final Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price', ['min_price']), - ['min_price'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price', ['website_id', 'customer_group_id', 'min_price']), - ['website_id', 'customer_group_id', 'min_price'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_index_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Price Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_tier_price' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_tier_price') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_tier_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_tier_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_index_tier_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_tier_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Tier Price Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_website' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_website') - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'website_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Website Date' - ) - ->addColumn( - 'rate', - \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, - null, - ['default' => '1.0000'], - 'Rate' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_website', ['website_date']), - ['website_date'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Website Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_cfg_opt_agr_idx' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_agr_idx') - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Parent ID' - ) - ->addColumn( - 'child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Child ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setComment( - 'Catalog Product Price Indexer Config Option Aggregate Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_cfg_opt_agr_tmp' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_agr_tmp') - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Parent ID' - ) - ->addColumn( - 'child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Child ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Config Option Aggregate Temp Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_cfg_opt_idx' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setComment( - 'Catalog Product Price Indexer Config Option Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_cfg_opt_tmp' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Config Option Temp Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_final_idx' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_final_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class ID' - ) - ->addColumn( - 'orig_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Original Price' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'base_tier', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tier' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) - ->setComment( - 'Catalog Product Price Indexer Final Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_final_tmp' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_final_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class ID' - ) - ->addColumn( - 'orig_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Original Price' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'base_tier', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tier' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Final Temp Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_opt_idx' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_opt_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setComment( - 'Catalog Product Price Indexer Option Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_opt_tmp' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_opt_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Option Temp Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_opt_agr_idx' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_opt_agr_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setComment( - 'Catalog Product Price Indexer Option Aggregate Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_opt_agr_tmp' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_opt_agr_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Option Aggregate Temp Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_eav_idx' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_idx', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_idx', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_idx', ['value']), - ['value'] - ) - ->setComment( - 'Catalog Product EAV Indexer Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_eav_tmp' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_tmp', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_tmp', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_tmp', ['value']), - ['value'] - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product EAV Indexer Temp Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_eav_decimal_idx' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav_decimal_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'primary' => true], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['value']), - ['value'] - ) - ->setComment( - 'Catalog Product EAV Decimal Indexer Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_eav_decimal_tmp' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav_decimal_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'primary' => false], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['value']), - ['value'] - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product EAV Decimal Indexer Temp Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_idx' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'final_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Final Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_idx', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_idx', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_idx', ['min_price']), - ['min_price'] - ) - ->setComment( - 'Catalog Product Price Indexer Index Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_price_tmp' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'final_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Final Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_tmp', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_tmp', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_tmp', ['min_price']), - ['min_price'] - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Temp Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_category_product_index_tmp' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_category_product_index_tmp') - ) - ->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Category ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Position' - ) - ->addColumn( - 'is_parent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Parent' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'visibility', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Visibility' - ) - ->addIndex( - $installer->getIdxName('catalog_category_product_index_tmp', ['product_id', 'category_id', 'store_id']), - ['product_id', 'category_id', 'store_id'] - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Category Product Indexer Temp Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_entity_group_price' - */ -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_entity_group_price') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'all_groups', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Applicable To All Customer Groups' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Group ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Website ID' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_group_price', - ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_group_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_group_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_group_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_group_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_group_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Group Price Attribute Backend Table' - ); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'catalog_product_index_group_price' - */ - -$table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_group_price') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_group_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_group_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_index_group_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_group_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_group_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Group Price Index Table' - ); -$installer->getConnection() - ->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-2.0.0-2.0.0.1.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-2.0.0-2.0.0.1.php deleted file mode 100644 index 3b2e669b511bd..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-2.0.0-2.0.0.1.php +++ /dev/null @@ -1,35 +0,0 @@ -startSetup(); - -$connection = $installer->getConnection(); -$connection->dropForeignKey( - $installer->getTable('catalog_product_entity'), - 'FK_CAT_PRD_ENTT_ENTT_TYPE_ID_EAV_ENTT_TYPE_ENTT_TYPE_ID' -); - -//Drop entity_type_id column for catalog product entities -$connection->dropColumn($installer->getTable('catalog_product_entity'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_product_entity_datetime'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_product_entity_decimal'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_product_entity_gallery'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_product_entity_int'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_product_entity_text'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_product_entity_varchar'), 'entity_type_id'); - -//Drop entity_type_id column for catalog category entities -$connection->dropColumn($installer->getTable('catalog_category_entity'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_category_entity_datetime'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_category_entity_decimal'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_category_entity_int'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_category_entity_text'), 'entity_type_id'); -$connection->dropColumn($installer->getTable('catalog_category_entity_varchar'), 'entity_type_id'); - -$installer->endSetup(); diff --git a/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-2.0.0.php b/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-2.0.0.php deleted file mode 100644 index 562d89922a17d..0000000000000 --- a/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-2.0.0.php +++ /dev/null @@ -1,440 +0,0 @@ -startSetup(); - -/** - * Create table 'cataloginventory_stock' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('cataloginventory_stock')) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Stock Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 5, - ['unsigned' => true, 'nullable' => false], - 'Website Id' - ) - ->addColumn( - 'stock_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Stock Name' - ) - ->addIndex( - $this->getIdxName( - $installer->getTable('cataloginventory_stock'), - ['website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX - ), - ['website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX - ) - ->setComment('Cataloginventory Stock'); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'cataloginventory_stock_item' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('cataloginventory_stock_item')) - ->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Item Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Id' - ) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Stock Id' - ) - ->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['unsigned' => false, 'nullable' => true, 'default' => null], - 'Qty' - ) - ->addColumn( - 'min_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Min Qty' - ) - ->addColumn( - 'use_config_min_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Min Qty' - ) - ->addColumn( - 'is_qty_decimal', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Qty Decimal' - ) - ->addColumn( - 'backorders', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Backorders' - ) - ->addColumn( - 'use_config_backorders', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Backorders' - ) - ->addColumn( - 'min_sale_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '1.0000'], - 'Min Sale Qty' - ) - ->addColumn( - 'use_config_min_sale_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Min Sale Qty' - ) - ->addColumn( - 'max_sale_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Max Sale Qty' - ) - ->addColumn( - 'use_config_max_sale_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Max Sale Qty' - ) - ->addColumn( - 'is_in_stock', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is In Stock' - ) - ->addColumn( - 'low_stock_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Low Stock Date' - ) - ->addColumn( - 'notify_stock_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Notify Stock Qty' - ) - ->addColumn( - 'use_config_notify_stock_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Notify Stock Qty' - ) - ->addColumn( - 'manage_stock', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Manage Stock' - ) - ->addColumn( - 'use_config_manage_stock', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Manage Stock' - ) - ->addColumn( - 'stock_status_changed_auto', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Stock Status Changed Automatically' - ) - ->addColumn( - 'use_config_qty_increments', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Qty Increments' - ) - ->addColumn( - 'qty_increments', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty Increments' - ) - ->addColumn( - 'use_config_enable_qty_inc', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Enable Qty Increments' - ) - ->addColumn( - 'enable_qty_increments', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Enable Qty Increments' - ) - ->addColumn( - 'is_decimal_divided', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 5, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Divided into Multiple Boxes for Shipping' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 5, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Is Divided into Multiple Boxes for Shipping' - ) - ->addIndex( - $installer->getIdxName( - 'cataloginventory_stock_item', - ['product_id', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_id', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName( - 'cataloginventory_stock_item', - ['website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX - ), - ['website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX] - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_item', ['stock_id']), - ['stock_id'] - ) - ->addForeignKey( - $installer->getFkName('cataloginventory_stock_item', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('cataloginventory_stock_item', 'stock_id', 'cataloginventory_stock', 'stock_id'), - 'stock_id', - $installer->getTable('cataloginventory_stock'), - 'stock_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Cataloginventory Stock Item'); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'cataloginventory_stock_status' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('cataloginventory_stock_status')) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Stock Id' - ) - ->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty' - ) - ->addColumn( - 'stock_status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Stock Status' - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status', ['stock_id']), - ['stock_id'] - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status', ['website_id']), - ['website_id'] - ) - ->setComment('Cataloginventory Stock Status'); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'cataloginventory_stock_status_idx' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('cataloginventory_stock_status_idx')) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Stock Id' - ) - ->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty' - ) - ->addColumn( - 'stock_status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Stock Status' - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status_idx', ['stock_id']), - ['stock_id'] - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status_idx', ['website_id']), - ['website_id'] - ) - ->setComment('Cataloginventory Stock Status Indexer Idx'); -$installer->getConnection() - ->createTable($table); - -/** - * Create table 'cataloginventory_stock_status_tmp' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('cataloginventory_stock_status_tmp')) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Stock Id' - ) - ->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty' - ) - ->addColumn( - 'stock_status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Stock Status' - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status_tmp', ['stock_id']), - ['stock_id'] - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status_tmp', ['website_id']), - ['website_id'] - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment('Cataloginventory Stock Status Indexer Tmp'); -$installer->getConnection() - ->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/CatalogRule/data/catalogrule_setup/data-install-2.0.0.php b/app/code/Magento/CatalogRule/data/catalogrule_setup/data-install-2.0.0.php deleted file mode 100644 index 23d9fc6acdb60..0000000000000 --- a/app/code/Magento/CatalogRule/data/catalogrule_setup/data-install-2.0.0.php +++ /dev/null @@ -1,28 +0,0 @@ -createMigrationSetup(); -$installer->startSetup(); - -$installer->appendClassAliasReplace( - 'catalogrule', - 'conditions_serialized', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, - ['rule_id'] -); -$installer->appendClassAliasReplace( - 'catalogrule', - 'actions_serialized', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, - ['rule_id'] -); - -$installer->doUpdateClassAliases(); - -$installer->endSetup(); diff --git a/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-2.0.0.php b/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-2.0.0.php deleted file mode 100644 index 0387eea1dea6a..0000000000000 --- a/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-2.0.0.php +++ /dev/null @@ -1,513 +0,0 @@ -startSetup(); - -/** - * Create table 'catalogrule' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule')) - ->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' - ) - ->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' - ) - ->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - ) - ->addColumn( - 'from_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'From Date' - ) - ->addColumn( - 'to_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'To Date' - ) - ->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Is Active' - ) - ->addColumn( - 'conditions_serialized', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Conditions Serialized' - ) - ->addColumn( - 'actions_serialized', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Actions Serialized' - ) - ->addColumn( - 'stop_rules_processing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Stop Rules Processing' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - ) - ->addColumn( - 'simple_action', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Simple Action' - ) - ->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => 0.0000], - 'Discount Amount' - ) - ->addColumn( - 'sub_is_enable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Rule Enable For Subitems' - ) - ->addColumn( - 'sub_simple_action', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Simple Action For Subitems' - ) - ->addColumn( - 'sub_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => 0.0000], - 'Discount Amount For Subitems' - ) - ->addIndex( - $installer->getIdxName('catalogrule', ['is_active', 'sort_order', 'to_date', 'from_date']), - ['is_active', 'sort_order', 'to_date', 'from_date'] - ) - ->setComment('CatalogRule'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalogrule_product' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_product')) - ->addColumn( - 'rule_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Product Id' - ) - ->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rule Id' - ) - ->addColumn( - 'from_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'From Time' - ) - ->addColumn( - 'to_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'To time' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Group Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Id' - ) - ->addColumn( - 'action_operator', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 10, - ['default' => 'to_fixed'], - 'Action Operator' - ) - ->addColumn( - 'action_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Action Amount' - ) - ->addColumn( - 'action_stop', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Action Stop' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Website Id' - ) - ->addColumn( - 'sub_simple_action', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Simple Action For Subitems' - ) - ->addColumn( - 'sub_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount For Subitems' - ) - ->addIndex( - $installer->getIdxName( - 'catalogrule_product', - ['rule_id', 'from_time', 'to_time', 'website_id', 'customer_group_id', 'product_id', 'sort_order'], - true - ), - ['rule_id', 'from_time', 'to_time', 'website_id', 'customer_group_id', 'product_id', 'sort_order'], - ['type' => 'unique'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product', ['from_time']), - ['from_time'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product', ['to_time']), - ['to_time'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product', ['product_id']), - ['product_id'] - ) - ->setComment('CatalogRule Product'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalogrule_product_price' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_product_price')) - ->addColumn( - 'rule_product_price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Product PriceId' - ) - ->addColumn( - 'rule_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => false], - 'Rule Date' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Group Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Id' - ) - ->addColumn( - 'rule_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Rule Price' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Website Id' - ) - ->addColumn( - 'latest_start_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Latest StartDate' - ) - ->addColumn( - 'earliest_end_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Earliest EndDate' - ) - ->addIndex( - $installer->getIdxName( - 'catalogrule_product_price', - ['rule_date', 'website_id', 'customer_group_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['rule_date', 'website_id', 'customer_group_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product_price', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product_price', ['product_id']), - ['product_id'] - ) - ->setComment('CatalogRule Product Price'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalogrule_affected_product' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_affected_product')) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Id' - ) - ->setComment('CatalogRule Affected Product'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalogrule_group_website' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_group_website')) - ->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Rule Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Website Id' - ) - ->addIndex( - $installer->getIdxName('catalogrule_group_website', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_group_website', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName('catalogrule_group_website', 'customer_group_id', 'customer_group', 'customer_group_id'), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalogrule_group_website', 'rule_id', 'catalogrule', 'rule_id'), - 'rule_id', - $installer->getTable('catalogrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalogrule_group_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('CatalogRule Group Website'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalogrule_website' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_website')) - ->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addIndex( - $installer->getIdxName('catalogrule_website', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName('catalogrule_website', 'rule_id', 'catalogrule', 'rule_id'), - 'rule_id', - $installer->getTable('catalogrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalogrule_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Rules To Websites Relations'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalogrule_customer_group' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_customer_group')) - ->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addIndex( - $installer->getIdxName('catalogrule_customer_group', ['customer_group_id']), - ['customer_group_id'] - ) - ->addForeignKey( - $installer->getFkName('catalogrule_customer_group', 'rule_id', 'catalogrule', 'rule_id'), - 'rule_id', - $installer->getTable('catalogrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalogrule_customer_group', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Rules To Customer Groups Relations'); - -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-2.0.0.php b/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-2.0.0.php deleted file mode 100644 index 50d2c77faf7be..0000000000000 --- a/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-2.0.0.php +++ /dev/null @@ -1,71 +0,0 @@ -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->endSetup(); diff --git a/app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-2.0.0.php b/app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-2.0.0.php deleted file mode 100644 index 846dee10c7f24..0000000000000 --- a/app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-2.0.0.php +++ /dev/null @@ -1,67 +0,0 @@ -startSetup(); - -$tableName = \Magento\CatalogUrlRewrite\Model\Resource\Category\Product::TABLE_NAME; -$table = $installer->getConnection() - ->newTable($installer->getTable($tableName)) - ->addColumn( - 'url_rewrite_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'url_rewrite_id' - ) - ->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'category_id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'product_id' - ) - ->addIndex( - $installer->getIdxName($tableName, ['category_id', 'product_id']), - ['category_id', 'product_id'] - ) - ->addForeignKey( - $installer->getFkName($tableName, 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName($tableName, 'category_id', 'catalog_category_entity', 'entity_id'), - 'category_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName($tableName, 'url_rewrite_id', 'url_rewrite', 'url_rewrite_id'), - 'url_rewrite_id', - $installer->getTable('url_rewrite'), - 'url_rewrite_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('url_rewrite_relation'); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php b/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php deleted file mode 100644 index 2e60539147c3a..0000000000000 --- a/app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/install-2.0.0.php +++ /dev/null @@ -1,99 +0,0 @@ -startSetup(); - -/** - * Create table 'checkout_agreement' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('checkout_agreement') -)->addColumn( - 'agreement_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Agreement Id' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' -)->addColumn( - 'content', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Content' -)->addColumn( - 'content_height', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 25, - [], - 'Content Height' -)->addColumn( - 'checkbox_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Checkbox Text' -)->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Is Active' -)->addColumn( - 'is_html', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Is Html' -)->setComment( - 'Checkout Agreement' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'checkout_agreement_store' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('checkout_agreement_store') -)->addColumn( - 'agreement_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Agreement Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store Id' -)->addForeignKey( - $installer->getFkName('checkout_agreement_store', 'agreement_id', 'checkout_agreement', 'agreement_id'), - 'agreement_id', - $installer->getTable('checkout_agreement'), - 'agreement_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('checkout_agreement_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Checkout Agreement Store' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php b/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php deleted file mode 100644 index f6fbbde761173..0000000000000 --- a/app/code/Magento/Cms/sql/cms_setup/install-2.0.0.php +++ /dev/null @@ -1,263 +0,0 @@ -startSetup(); - -/** - * Create table 'cms_block' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('cms_block') -)->addColumn( - 'block_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Block ID' -)->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Block Title' -)->addColumn( - 'identifier', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Block String Identifier' -)->addColumn( - 'content', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Block Content' -)->addColumn( - 'creation_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Block Creation Time' -)->addColumn( - 'update_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Block Modification Time' -)->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Is Block Active' -)->setComment( - 'CMS Block Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'cms_block_store' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('cms_block_store') -)->addColumn( - 'block_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'primary' => true], - 'Block ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' -)->addIndex( - $installer->getIdxName('cms_block_store', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('cms_block_store', 'block_id', 'cms_block', 'block_id'), - 'block_id', - $installer->getTable('cms_block'), - 'block_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('cms_block_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'CMS Block To Store Linkage Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'cms_page' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('cms_page') -)->addColumn( - 'page_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Page ID' -)->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Page Title' -)->addColumn( - 'page_layout', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Page Layout' -)->addColumn( - 'meta_keywords', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Page Meta Keywords' -)->addColumn( - 'meta_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Page Meta Description' -)->addColumn( - 'identifier', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['nullable' => true, 'default' => null], - 'Page String Identifier' -)->addColumn( - 'content_heading', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Page Content Heading' -)->addColumn( - 'content', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Page Content' -)->addColumn( - 'creation_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Page Creation Time' -)->addColumn( - 'update_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Page Modification Time' -)->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Is Page Active' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Page Sort Order' -)->addColumn( - 'layout_update_xml', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Page Layout Update Content' -)->addColumn( - 'custom_theme', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['nullable' => true], - 'Page Custom Theme' -)->addColumn( - 'custom_root_template', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Page Custom Template' -)->addColumn( - 'custom_layout_update_xml', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Page Custom Layout Update Content' -)->addColumn( - 'custom_theme_from', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => true], - 'Page Custom Theme Active From Date' -)->addColumn( - 'custom_theme_to', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => true], - 'Page Custom Theme Active To Date' -)->addIndex( - $installer->getIdxName('cms_page', ['identifier']), - ['identifier'] -)->setComment( - 'CMS Page Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'cms_page_store' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('cms_page_store') -)->addColumn( - 'page_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'primary' => true], - 'Page ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' -)->addIndex( - $installer->getIdxName('cms_page_store', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('cms_page_store', 'page_id', 'cms_page', 'page_id'), - 'page_id', - $installer->getTable('cms_page'), - 'page_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('cms_page_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'CMS Page To Store Linkage Table' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.0.php b/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.0.php deleted file mode 100644 index 9f6efa69cc8a4..0000000000000 --- a/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.0.php +++ /dev/null @@ -1,300 +0,0 @@ -startSetup(); - -/** - * Create table 'catalog_product_super_attribute' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_super_attribute')) - ->addColumn( - 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Super Attribute ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Position' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_super_attribute', - ['product_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_id', 'attribute_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_super_attribute', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION - ) - ->setComment('Catalog Product Super Attribute Table'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_super_attribute_label' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_super_attribute_label')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Super Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'use_default', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Use Default Value' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_super_attribute_label', - ['product_super_attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_super_attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_super_attribute_label', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_super_attribute_label', - 'product_super_attribute_id', - 'catalog_product_super_attribute', - 'product_super_attribute_id' - ), - 'product_super_attribute_id', - $installer->getTable('catalog_product_super_attribute'), - 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_super_attribute_label', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Super Attribute Label Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_super_attribute_pricing' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_super_attribute_pricing')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Super Attribute ID' - ) - ->addColumn( - 'value_index', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Value Index' - ) - ->addColumn( - 'is_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Is Percent' - ) - ->addColumn( - 'pricing_value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Pricing Value' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website ID' - ) - ->addIndex( - $installer->getIdxName('catalog_product_super_attribute_pricing', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_super_attribute_pricing', - ['product_super_attribute_id', 'value_index', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_super_attribute_id', 'value_index', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_super_attribute_pricing', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_super_attribute_pricing', - 'product_super_attribute_id', - 'catalog_product_super_attribute', - 'product_super_attribute_id' - ), - 'product_super_attribute_id', - $installer->getTable('catalog_product_super_attribute'), - 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Super Attribute Pricing Table'); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_super_link' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_super_link')) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Link ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Parent ID' - ) - ->addIndex( - $installer->getIdxName('catalog_product_super_link', ['parent_id']), - ['parent_id'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_super_link', - ['product_id', 'parent_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_id', 'parent_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_super_link', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_super_link', 'parent_id', 'catalog_product_entity', 'entity_id'), - 'parent_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Super Link Table'); - -$installer->getConnection()->createTable($table); - -$table = $installer->getConnection() - ->addColumn( - $installer->getTable('catalog_eav_attribute'), - 'is_configurable', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 'unsigned' => true, - 'default' => null, - 'comment' => 'Can be used to create configurable product' - ] - ); - -$installer->endSetup(); diff --git a/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/upgrade-2.0.0-2.0.1.php b/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/upgrade-2.0.0-2.0.1.php deleted file mode 100644 index 9d496cd3dc7b2..0000000000000 --- a/app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/upgrade-2.0.0-2.0.1.php +++ /dev/null @@ -1,19 +0,0 @@ -startSetup(); - -$table = $installer->getConnection() - ->dropColumn( - $installer->getTable('catalog_eav_attribute'), - 'is_configurable' - ); - -$installer->endSetup(); diff --git a/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php b/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php deleted file mode 100644 index f630e44654a09..0000000000000 --- a/app/code/Magento/Core/data/core_setup/data-install-2.0.0.php +++ /dev/null @@ -1,35 +0,0 @@ -createMigrationSetup(); -$installer->startSetup(); - -$installer->appendClassAliasReplace( - 'core_config_data', - 'value', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['config_id'] -); -$installer->appendClassAliasReplace( - 'core_layout_update', - 'xml', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, - ['layout_update_id'] -); -$installer->doUpdateClassAliases(); - -/** - * Delete rows by condition from authorization_rule - */ -$tableName = $installer->getTable('authorization_rule'); -if ($tableName) { - $installer->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']); -} - -$installer->endSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/install-2.0.0.php b/app/code/Magento/Core/sql/core_setup/install-2.0.0.php deleted file mode 100644 index 657a8006a31e9..0000000000000 --- a/app/code/Magento/Core/sql/core_setup/install-2.0.0.php +++ /dev/null @@ -1,475 +0,0 @@ -getConnection(); - -$installer->startSetup(); - -/** - * Create table 'core_config_data' - */ -$table = $connection->newTable( - $installer->getTable('core_config_data') -)->addColumn( - 'config_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Config Id' -)->addColumn( - 'scope', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 8, - ['nullable' => false, 'default' => 'default'], - 'Config Scope' -)->addColumn( - 'scope_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Config Scope Id' -)->addColumn( - 'path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false, 'default' => 'general'], - 'Config Path' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Config Value' -)->addIndex( - $installer->getIdxName( - 'core_config_data', - ['scope', 'scope_id', 'path'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['scope', 'scope_id', 'path'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->setComment( - 'Config Data' -); -$connection->createTable($table); - -/** - * Create table 'core_layout_update' - */ -$table = $connection->newTable( - $installer->getTable('core_layout_update') -)->addColumn( - 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Layout Update Id' -)->addColumn( - 'handle', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Handle' -)->addColumn( - 'xml', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Xml' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Last Update Timestamp' -)->addIndex( - $installer->getIdxName('core_layout_update', ['handle']), - ['handle'] -)->setComment( - 'Layout Updates' -); -$connection->createTable($table); - -/** - * Create table 'core_layout_link' - */ -$table = $connection->newTable( - $installer->getTable('core_layout_link') -)->addColumn( - 'layout_link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Link Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'theme_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Theme id' -)->addColumn( - 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Layout Update Id' -)->addColumn( - 'is_temporary', - \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - null, - ['nullable' => false, 'default' => '0'], - 'Defines whether Layout Update is Temporary' -)->addIndex( - $installer->getIdxName('core_layout_link', ['layout_update_id']), - ['layout_update_id'] -)->addForeignKey( - $installer->getFkName('core_layout_link', 'layout_update_id', 'core_layout_update', 'layout_update_id'), - 'layout_update_id', - $installer->getTable('core_layout_update'), - 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addIndex( - $installer->getIdxName( - 'core_layout_link', - ['store_id', 'theme_id', 'layout_update_id', 'is_temporary'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['store_id', 'theme_id', 'layout_update_id', 'is_temporary'] -)->addForeignKey( - $installer->getFkName('core_layout_link', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('core_layout_link', 'theme_id', 'theme', 'theme_id'), - 'theme_id', - $installer->getTable('theme'), - 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Layout Link' -); -$connection->createTable($table); - -/** - * Create table 'core_session' - */ -$table = $connection->newTable( - $installer->getTable('core_session') -)->addColumn( - 'session_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false, 'primary' => true], - 'Session Id' -)->addColumn( - 'session_expires', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Date of Session Expiration' -)->addColumn( - 'session_data', - \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, - '2M', - ['nullable' => false], - 'Session Data' -)->setComment( - 'Database Sessions Storage' -); -$connection->createTable($table); - -/** - * Create table 'design_change' - */ -$table = $connection->newTable( - $installer->getTable('design_change') -)->addColumn( - 'design_change_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Design Change Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'design', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Design' -)->addColumn( - 'date_from', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'First Date of Design Activity' -)->addColumn( - 'date_to', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Last Date of Design Activity' -)->addIndex( - $installer->getIdxName('design_change', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('design_change', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Design Changes' -); -$connection->createTable($table); - -/** - * Create table 'core_variable' - */ -$table = $connection->newTable( - $installer->getTable('core_variable') -)->addColumn( - 'variable_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Variable Id' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Variable Code' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Variable Name' -)->addIndex( - $installer->getIdxName( - 'core_variable', - ['code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->setComment( - 'Variables' -); -$connection->createTable($table); - -/** - * Create table 'core_variable_value' - */ -$table = $connection->newTable( - $installer->getTable('core_variable_value') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Variable Value Id' -)->addColumn( - 'variable_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Variable Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'plain_value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Plain Text Value' -)->addColumn( - 'html_value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Html Value' -)->addIndex( - $installer->getIdxName( - 'core_variable_value', - ['variable_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['variable_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('core_variable_value', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('core_variable_value', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('core_variable_value', 'variable_id', 'core_variable', 'variable_id'), - 'variable_id', - $installer->getTable('core_variable'), - 'variable_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Variable Value' -); -$connection->createTable($table); - -/** - * Create table 'core_cache' - */ -$table = $connection->newTable( - $installer->getTable('core_cache') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - ['nullable' => false, 'primary' => true], - 'Cache Id' -)->addColumn( - 'data', - \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, - '2M', - [], - 'Cache Data' -)->addColumn( - 'create_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Cache Creation Time' -)->addColumn( - 'update_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Time of Cache Updating' -)->addColumn( - 'expire_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Cache Expiration Time' -)->addIndex( - $installer->getIdxName('core_cache', ['expire_time']), - ['expire_time'] -)->setComment( - 'Caches' -); -$connection->createTable($table); - -/** - * Create table 'core_cache_tag' - */ -$table = $connection->newTable( - $installer->getTable('core_cache_tag') -)->addColumn( - 'tag', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['nullable' => false, 'primary' => true], - 'Tag' -)->addColumn( - 'cache_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - ['nullable' => false, 'primary' => true], - 'Cache Id' -)->addIndex( - $installer->getIdxName('core_cache_tag', ['cache_id']), - ['cache_id'] -)->setComment( - 'Tag Caches' -); -$connection->createTable($table); - -/** - * Create table 'core_flag' - */ -$table = $connection->newTable( - $installer->getTable('core_flag') -)->addColumn( - 'flag_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Flag Id' -)->addColumn( - 'flag_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Flag Code' -)->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Flag State' -)->addColumn( - 'flag_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Flag Data' -)->addColumn( - 'last_update', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], - 'Date of Last Flag Update' -)->addIndex( - $installer->getIdxName('core_flag', ['last_update']), - ['last_update'] -)->setComment( - 'Flag' -); -$connection->createTable($table); - -/** - * Drop Foreign Key on core_cache_tag.cache_id - */ -$connection->dropForeignKey( - $installer->getTable('core_cache_tag'), - $installer->getFkName('core_cache_tag', 'cache_id', 'core_cache', 'id') -); - -$installer->endSetup(); diff --git a/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php b/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php deleted file mode 100644 index 9e18182db0e84..0000000000000 --- a/app/code/Magento/Cron/sql/cron_setup/install-2.0.0.php +++ /dev/null @@ -1,76 +0,0 @@ -startSetup(); - -/** - * Create table 'cron_schedule' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('cron_schedule') -)->addColumn( - 'schedule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Schedule Id' -)->addColumn( - 'job_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false, 'default' => '0'], - 'Job Code' -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 7, - ['nullable' => false, 'default' => 'pending'], - 'Status' -)->addColumn( - 'messages', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Messages' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Created At' -)->addColumn( - 'scheduled_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Scheduled At' -)->addColumn( - 'executed_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Executed At' -)->addColumn( - 'finished_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Finished At' -)->addIndex( - $installer->getIdxName('cron_schedule', ['job_code']), - ['job_code'] -)->addIndex( - $installer->getIdxName('cron_schedule', ['scheduled_at', 'status']), - ['scheduled_at', 'status'] -)->setComment( - 'Cron Schedule' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php b/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php deleted file mode 100644 index 80b5050822741..0000000000000 --- a/app/code/Magento/Customer/sql/customer_setup/install-2.0.0.php +++ /dev/null @@ -1,1182 +0,0 @@ -startSetup(); - -/** - * Create table 'customer_entity' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true], - 'Website Id' -)->addColumn( - 'email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Email' -)->addColumn( - 'group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Group Id' -)->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Store Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Created At' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Updated At' -)->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Active' -)->addColumn( - 'disable_auto_group_change', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Disable automatic group change based on VAT ID' -)->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', - ['email', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['email', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('customer_entity', ['website_id']), - ['website_id'] -)->addForeignKey( - $installer->getFkName('customer_entity', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_entity', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Entity' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_address_entity' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - 50, - [], - 'Increment Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true], - 'Parent Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Created At' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Updated At' -)->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Active' -)->addIndex( - $installer->getIdxName('customer_address_entity', ['parent_id']), - ['parent_id'] -)->addForeignKey( - $installer->getFkName('customer_address_entity', 'parent_id', 'customer_entity', 'entity_id'), - 'parent_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Address Entity' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_address_entity_datetime' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity_datetime') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - ['nullable' => true, 'default' => null], - 'Value' -)->addIndex( - $installer->getIdxName( - 'customer_address_entity_datetime', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] -)->addIndex( - $installer->getIdxName('customer_address_entity_datetime', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] -)->addForeignKey( - $installer->getFkName('customer_address_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_address_entity_datetime', 'entity_id', 'customer_address_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_address_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Address Entity Datetime' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_address_entity_decimal' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity_decimal') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' -)->addIndex( - $installer->getIdxName( - 'customer_address_entity_decimal', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] -)->addIndex( - $installer->getIdxName('customer_address_entity_decimal', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] -)->addForeignKey( - $installer->getFkName('customer_address_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_address_entity_decimal', 'entity_id', 'customer_address_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_address_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Address Entity Decimal' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_address_entity_int' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity_int') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Value' -)->addIndex( - $installer->getIdxName( - 'customer_address_entity_int', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] -)->addIndex( - $installer->getIdxName('customer_address_entity_int', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] -)->addForeignKey( - $installer->getFkName('customer_address_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_address_entity_int', 'entity_id', 'customer_address_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_address_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Address Entity Int' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_address_entity_text' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity_text') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Value' -)->addIndex( - $installer->getIdxName( - 'customer_address_entity_text', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] -)->addForeignKey( - $installer->getFkName('customer_address_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_address_entity_text', 'entity_id', 'customer_address_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_address_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Address Entity Text' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_address_entity_varchar' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity_varchar') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' -)->addIndex( - $installer->getIdxName( - 'customer_address_entity_varchar', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] -)->addIndex( - $installer->getIdxName('customer_address_entity_varchar', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] -)->addForeignKey( - $installer->getFkName('customer_address_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_address_entity_varchar', 'entity_id', 'customer_address_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_address_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Address Entity Varchar' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_entity_datetime' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity_datetime') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - ['nullable' => true, 'default' => null], - 'Value' -)->addIndex( - $installer->getIdxName( - 'customer_entity_datetime', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] -)->addIndex( - $installer->getIdxName('customer_entity_datetime', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] -)->addForeignKey( - $installer->getFkName('customer_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_entity_datetime', 'entity_id', 'customer_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Entity Datetime' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_entity_decimal' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity_decimal') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' -)->addIndex( - $installer->getIdxName( - 'customer_entity_decimal', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] -)->addIndex( - $installer->getIdxName('customer_entity_decimal', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] -)->addForeignKey( - $installer->getFkName('customer_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_entity_decimal', 'entity_id', 'customer_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Entity Decimal' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_entity_int' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity_int') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Value' -)->addIndex( - $installer->getIdxName( - 'customer_entity_int', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] -)->addIndex( - $installer->getIdxName('customer_entity_int', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] -)->addForeignKey( - $installer->getFkName('customer_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_entity_int', 'entity_id', 'customer_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Entity Int' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_entity_text' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity_text') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Value' -)->addIndex( - $installer->getIdxName( - 'customer_entity_text', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] -)->addForeignKey( - $installer->getFkName('customer_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_entity_text', 'entity_id', 'customer_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Entity Text' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_entity_varchar' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity_varchar') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' -)->addIndex( - $installer->getIdxName( - 'customer_entity_varchar', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] -)->addIndex( - $installer->getIdxName('customer_entity_varchar', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] -)->addForeignKey( - $installer->getFkName('customer_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_entity_varchar', 'entity_id', 'customer_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Entity Varchar' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_group' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_group') -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' -)->addColumn( - 'customer_group_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Customer Group Code' -)->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Tax Class Id' -)->setComment( - 'Customer Group' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_eav_attribute' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_eav_attribute') -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Id' -)->addColumn( - 'is_visible', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Visible' -)->addColumn( - 'input_filter', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Input Filter' -)->addColumn( - 'multiline_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Multiline Count' -)->addColumn( - 'validate_rules', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Validate Rules' -)->addColumn( - 'is_system', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is System' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' -)->addColumn( - 'data_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Data Model' -)->addForeignKey( - $installer->getFkName('customer_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Eav Attribute' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_form_attribute' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_form_attribute') -)->addColumn( - 'form_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Form Code' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Id' -)->addIndex( - $installer->getIdxName('customer_form_attribute', ['attribute_id']), - ['attribute_id'] -)->addForeignKey( - $installer->getFkName('customer_form_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Form Attribute' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_eav_attribute_website' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_eav_attribute_website') -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Id' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' -)->addColumn( - 'is_visible', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Visible' -)->addColumn( - 'is_required', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Required' -)->addColumn( - 'default_value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Default Value' -)->addColumn( - 'multiline_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Multiline Count' -)->addIndex( - $installer->getIdxName('customer_eav_attribute_website', ['website_id']), - ['website_id'] -)->addForeignKey( - $installer->getFkName('customer_eav_attribute_website', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('customer_eav_attribute_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Customer Eav Attribute Website' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'customer_visitor' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('customer_visitor') -)->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Visitor ID' -)->addColumn( - 'session_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => true, 'default' => null], - 'Session ID' -)->addColumn( - 'last_visit_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Last Visit Time' -)->setComment( - 'Visitor Table' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php b/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php deleted file mode 100644 index 007591d1c07fc..0000000000000 --- a/app/code/Magento/Customer/sql/customer_setup/upgrade-2.0.0-2.0.0.1.php +++ /dev/null @@ -1,44 +0,0 @@ -startSetup(); -$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_UNIQUE - ) - ); - $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'); -$installer->endSetup(); diff --git a/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php b/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php deleted file mode 100644 index a92136ede3cbf..0000000000000 --- a/app/code/Magento/DesignEditor/sql/designeditor_setup/install-2.0.0.php +++ /dev/null @@ -1,49 +0,0 @@ -startSetup(); -$connection = $installer->getConnection(); - -/** - * Create table 'vde_theme_change' - */ -$table = $installer->getConnection()->newTable( - $installer->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( - $installer->getFkName('vde_theme_change', 'theme_id', 'theme', 'theme_id'), - 'theme_id', - $installer->getTable('theme'), - 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Design Editor Theme Change' -); - -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php b/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php deleted file mode 100644 index 2440cdb73334e..0000000000000 --- a/app/code/Magento/Directory/sql/directory_setup/install-2.0.0.php +++ /dev/null @@ -1,188 +0,0 @@ -startSetup(); - -/** - * Create table 'directory_country' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('directory_country') -)->addColumn( - 'country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - ['nullable' => false, 'primary' => true, 'default' => false], - 'Country Id in ISO-2' -)->addColumn( - 'iso2_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - ['nullable' => true, 'default' => null], - 'Country ISO-2 format' -)->addColumn( - 'iso3_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - ['nullable' => true, 'default' => null], - 'Country ISO-3' -)->setComment( - 'Directory Country' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'directory_country_format' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('directory_country_format') -)->addColumn( - 'country_format_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Country Format Id' -)->addColumn( - 'country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - ['nullable' => true, 'default' => null], - 'Country Id in ISO-2' -)->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 30, - ['nullable' => true, 'default' => null], - 'Country Format Type' -)->addColumn( - 'format', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Country Format' -)->addIndex( - $installer->getIdxName( - 'directory_country_format', - ['country_id', 'type'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['country_id', 'type'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->setComment( - 'Directory Country Format' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'directory_country_region' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('directory_country_region') -)->addColumn( - 'region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Region Id' -)->addColumn( - 'country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 4, - ['nullable' => false, 'default' => '0'], - 'Country Id in ISO-2' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true, 'default' => null], - 'Region code' -)->addColumn( - 'default_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Region Name' -)->addIndex( - $installer->getIdxName('directory_country_region', ['country_id']), - ['country_id'] -)->setComment( - 'Directory Country Region' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'directory_country_region_name' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('directory_country_region_name') -)->addColumn( - 'locale', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 8, - ['nullable' => false, 'primary' => true, 'default' => false], - 'Locale' -)->addColumn( - 'region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Region Id' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Region Name' -)->addIndex( - $installer->getIdxName('directory_country_region_name', ['region_id']), - ['region_id'] -)->addForeignKey( - $installer->getFkName('directory_country_region_name', 'region_id', 'directory_country_region', 'region_id'), - 'region_id', - $installer->getTable('directory_country_region'), - 'region_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Directory Country Region Name' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'directory_currency_rate' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('directory_currency_rate') -)->addColumn( - 'currency_from', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - ['nullable' => false, 'primary' => true, 'default' => false], - 'Currency Code Convert From' -)->addColumn( - 'currency_to', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - ['nullable' => false, 'primary' => true, 'default' => false], - 'Currency Code Convert To' -)->addColumn( - 'rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '24,12', - ['nullable' => false, 'default' => '0.000000000000'], - 'Currency Conversion Rate' -)->addIndex( - $installer->getIdxName('directory_currency_rate', ['currency_to']), - ['currency_to'] -)->setComment( - 'Directory Currency Rate' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Downloadable/sql/downloadable_setup/install-2.0.0.php b/app/code/Magento/Downloadable/sql/downloadable_setup/install-2.0.0.php deleted file mode 100644 index edae304c39a5c..0000000000000 --- a/app/code/Magento/Downloadable/sql/downloadable_setup/install-2.0.0.php +++ /dev/null @@ -1,710 +0,0 @@ -startSetup(); - -/** - * Create table 'downloadable_link' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_link')) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Link ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort order' - ) - ->addColumn( - 'number_of_downloads', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => true], - 'Number of downloads' - ) - ->addColumn( - 'is_shareable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Shareable flag' - ) - ->addColumn( - 'link_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link Url' - ) - ->addColumn( - 'link_file', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link File' - ) - ->addColumn( - 'link_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - [], - 'Link Type' - ) - ->addColumn( - 'sample_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sample Url' - ) - ->addColumn( - 'sample_file', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sample File' - ) - ->addColumn( - 'sample_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - [], - 'Sample Type' - ) - ->addIndex( - $installer->getIdxName('downloadable_link', ['product_id', 'sort_order']), - ['product_id', 'sort_order'] - ) - ->addForeignKey( - $installer->getFkName('downloadable_link', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Link Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'downloadable_link_price' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_link_price')) - ->addColumn( - 'price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Price ID' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Link ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_price', 'link_id'), - 'link_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_price', 'link_id', 'downloadable_link', 'link_id'), - 'link_id', - $installer->getTable('downloadable_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $installer->getIdxName('downloadable_link_price', 'website_id'), - 'website_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Link Price Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'downloadable_link_purchased' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_link_purchased')) - ->addColumn( - 'purchased_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Purchased ID' - ) - ->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Order ID' - ) - ->addColumn( - 'order_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Increment ID' - ) - ->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Order Item ID' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Date of creation' - ) - ->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Date of modification' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true, 'default' => '0'], - 'Customer ID' - ) - ->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Product name' - ) - ->addColumn( - 'product_sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Product sku' - ) - ->addColumn( - 'link_section_title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link_section_title' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased', 'order_id'), - 'order_id' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased', 'order_item_id'), - 'order_item_id' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased', 'customer_id'), - 'customer_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_purchased', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_purchased', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Link Purchased Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'downloadable_link_purchased_item' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_link_purchased_item')) - ->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Item ID' - ) - ->addColumn( - 'purchased_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Purchased ID' - ) - ->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Order Item ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'link_hash', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link hash' - ) - ->addColumn( - 'number_of_downloads_bought', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Number of downloads bought' - ) - ->addColumn( - 'number_of_downloads_used', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Number of downloads used' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Link ID' - ) - ->addColumn( - 'link_title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link Title' - ) - ->addColumn( - 'is_shareable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Shareable Flag' - ) - ->addColumn( - 'link_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link Url' - ) - ->addColumn( - 'link_file', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link File' - ) - ->addColumn( - 'link_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link Type' - ) - ->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Status' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Creation Time' - ) - ->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Update Time' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased_item', 'link_hash'), - 'link_hash' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased_item', 'order_item_id'), - 'order_item_id' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased_item', 'purchased_id'), - 'purchased_id' - ) - ->addForeignKey( - $installer->getFkName( - 'downloadable_link_purchased_item', - 'purchased_id', - 'downloadable_link_purchased', - 'purchased_id' - ), - 'purchased_id', - $installer->getTable('downloadable_link_purchased'), - 'purchased_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_purchased_item', 'order_item_id', 'sales_order_item', 'item_id'), - 'order_item_id', - $installer->getTable('sales_order_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Link Purchased Item Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'downloadable_link_title' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_link_title')) - ->addColumn( - 'title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Title ID' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Link ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Title' - ) - ->addIndex( - $installer->getIdxName( - 'downloadable_link_title', - ['link_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['link_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_title', 'link_id', 'downloadable_link', 'link_id'), - 'link_id', - $installer->getTable('downloadable_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $installer->getIdxName('downloadable_link_title', 'store_id'), - 'store_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Link Title Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'downloadable_sample' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_sample')) - ->addColumn( - 'sample_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Sample ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'sample_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sample URL' - ) - ->addColumn( - 'sample_file', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sample file' - ) - ->addColumn( - 'sample_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - [], - 'Sample Type' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - ) - ->addIndex( - $installer->getIdxName('downloadable_sample', 'product_id'), - 'product_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_sample', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Sample Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'downloadable_sample_title' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_sample_title')) - ->addColumn( - 'title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Title ID' - ) - ->addColumn( - 'sample_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sample ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Title' - ) - ->addIndex( - $installer->getIdxName( - 'downloadable_sample_title', - ['sample_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['sample_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('downloadable_sample_title', 'sample_id', 'downloadable_sample', 'sample_id'), - 'sample_id', - $installer->getTable('downloadable_sample'), - 'sample_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $installer->getIdxName('downloadable_sample_title', 'store_id'), - 'store_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_sample_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Sample Title Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_downlod_idx' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_downlod_idx')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Minimum price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Maximum price' - ) - ->setComment('Indexer Table for price of downloadable products'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_downlod_tmp' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_downlod_tmp')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Minimum price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Maximum price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment('Temporary Indexer Table for price of downloadable products'); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php b/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php deleted file mode 100644 index 70cb7bb46fcd3..0000000000000 --- a/app/code/Magento/Eav/sql/eav_setup/install-2.0.0.php +++ /dev/null @@ -1,1434 +0,0 @@ -startSetup(); - -/** - * Create table 'eav_entity_type' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_type') -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Type Id' -)->addColumn( - 'entity_type_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false], - 'Entity Type Code' -)->addColumn( - 'entity_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Entity Model' -)->addColumn( - 'attribute_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Attribute Model' -)->addColumn( - 'entity_table', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Entity Table' -)->addColumn( - 'value_table_prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value Table Prefix' -)->addColumn( - 'entity_id_field', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Entity Id Field' -)->addColumn( - 'is_data_sharing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Defines Is Data Sharing' -)->addColumn( - 'data_sharing_key', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['default' => 'default'], - 'Data Sharing Key' -)->addColumn( - 'default_attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Default Attribute Set Id' -)->addColumn( - 'increment_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => false], - 'Increment Model' -)->addColumn( - 'increment_per_store', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Increment Per Store' -)->addColumn( - 'increment_pad_length', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '8'], - 'Increment Pad Length' -)->addColumn( - 'increment_pad_char', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 1, - ['nullable' => false, 'default' => '0'], - 'Increment Pad Char' -)->addColumn( - 'additional_attribute_table', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => false], - 'Additional Attribute Table' -)->addColumn( - 'entity_attribute_collection', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Entity Attribute Collection' -)->addIndex( - $installer->getIdxName('eav_entity_type', ['entity_type_code']), - ['entity_type_code'] -)->setComment( - 'Eav Entity Type' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_entity' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - 50, - ['nullable' => true, 'default' => null], - 'Increment Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Parent Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Created At' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Updated At' -)->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Defines Is Entity Active' -)->addIndex( - $installer->getIdxName('eav_entity', ['entity_type_id']), - ['entity_type_id'] -)->addIndex( - $installer->getIdxName('eav_entity', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_entity', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Entity' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_entity_datetime' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_datetime') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - ['nullable' => true, 'default' => null], - 'Attribute Value' -)->addIndex( - $installer->getIdxName('eav_entity_datetime', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('eav_entity_datetime', ['attribute_id', 'value']), - ['attribute_id', 'value'] -)->addIndex( - $installer->getIdxName('eav_entity_datetime', ['entity_type_id', 'value']), - ['entity_type_id', 'value'] -)->addIndex( - $installer->getIdxName( - 'eav_entity_datetime', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('eav_entity_datetime', 'entity_id', 'eav_entity', 'entity_id'), - 'entity_id', - $installer->getTable('eav_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_entity_datetime', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Entity Value Prefix' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_entity_decimal' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_decimal') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Attribute Value' -)->addIndex( - $installer->getIdxName('eav_entity_decimal', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('eav_entity_decimal', ['attribute_id', 'value']), - ['attribute_id', 'value'] -)->addIndex( - $installer->getIdxName('eav_entity_decimal', ['entity_type_id', 'value']), - ['entity_type_id', 'value'] -)->addIndex( - $installer->getIdxName( - 'eav_entity_decimal', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('eav_entity_decimal', 'entity_id', 'eav_entity', 'entity_id'), - 'entity_id', - $installer->getTable('eav_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_entity_decimal', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Entity Value Prefix' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_entity_int' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_int') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Attribute Value' -)->addIndex( - $installer->getIdxName('eav_entity_int', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('eav_entity_int', ['attribute_id', 'value']), - ['attribute_id', 'value'] -)->addIndex( - $installer->getIdxName('eav_entity_int', ['entity_type_id', 'value']), - ['entity_type_id', 'value'] -)->addIndex( - $installer->getIdxName( - 'eav_entity_int', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('eav_entity_int', 'entity_id', 'eav_entity', 'entity_id'), - 'entity_id', - $installer->getTable('eav_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_entity_int', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Entity Value Prefix' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_entity_text' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_text') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Attribute Value' -)->addIndex( - $installer->getIdxName('eav_entity_text', ['entity_type_id']), - ['entity_type_id'] -)->addIndex( - $installer->getIdxName('eav_entity_text', ['attribute_id']), - ['attribute_id'] -)->addIndex( - $installer->getIdxName('eav_entity_text', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName( - 'eav_entity_text', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('eav_entity_text', 'entity_id', 'eav_entity', 'entity_id'), - 'entity_id', - $installer->getTable('eav_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_entity_text', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Entity Value Prefix' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_entity_varchar' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_varchar') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Attribute Value' -)->addIndex( - $installer->getIdxName('eav_entity_varchar', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('eav_entity_varchar', ['attribute_id', 'value']), - ['attribute_id', 'value'] -)->addIndex( - $installer->getIdxName('eav_entity_varchar', ['entity_type_id', 'value']), - ['entity_type_id', 'value'] -)->addIndex( - $installer->getIdxName( - 'eav_entity_varchar', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('eav_entity_varchar', 'entity_id', 'eav_entity', 'entity_id'), - 'entity_id', - $installer->getTable('eav_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_entity_varchar', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Entity Value Prefix' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_attribute' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute') -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Id' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' -)->addColumn( - 'attribute_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Attribute Code' -)->addColumn( - 'attribute_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Attribute Model' -)->addColumn( - 'backend_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Backend Model' -)->addColumn( - 'backend_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 8, - ['nullable' => false, 'default' => 'static'], - 'Backend Type' -)->addColumn( - 'backend_table', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Backend Table' -)->addColumn( - 'frontend_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Frontend Model' -)->addColumn( - 'frontend_input', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Frontend Input' -)->addColumn( - 'frontend_label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Frontend Label' -)->addColumn( - 'frontend_class', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Frontend Class' -)->addColumn( - 'source_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Source Model' -)->addColumn( - 'is_required', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Defines Is Required' -)->addColumn( - 'is_user_defined', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Defines Is User Defined' -)->addColumn( - 'default_value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Default Value' -)->addColumn( - 'is_unique', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Defines Is Unique' -)->addColumn( - 'note', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Note' -)->addIndex( - $installer->getIdxName( - 'eav_attribute', - ['entity_type_id', 'attribute_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'attribute_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('eav_attribute', '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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Attribute' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_entity_store' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_store') -)->addColumn( - 'entity_store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Store Id' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'increment_prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - ['nullable' => true], - 'Increment Prefix' -)->addColumn( - 'increment_last_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => true], - 'Last Incremented Id' -)->addIndex( - $installer->getIdxName('eav_entity_store', ['entity_type_id']), - ['entity_type_id'] -)->addIndex( - $installer->getIdxName('eav_entity_store', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('eav_entity_store', '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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_entity_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Entity Store' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_attribute_set' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute_set') -)->addColumn( - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Set 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_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Attribute Set Name' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' -)->addIndex( - $installer->getIdxName( - 'eav_attribute_set', - ['entity_type_id', 'attribute_set_name'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'attribute_set_name'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('eav_attribute_set', ['entity_type_id', 'sort_order']), - ['entity_type_id', 'sort_order'] -)->addForeignKey( - $installer->getFkName('eav_attribute_set', '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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Attribute Set' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_attribute_group' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute_group') -)->addColumn( - 'attribute_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Group Id' -)->addColumn( - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Set Id' -)->addColumn( - 'attribute_group_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Attribute Group Name' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' -)->addColumn( - 'default_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Default Id' -)->addColumn( - 'attribute_group_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['default' => null], - 'Attribute Group Code' -)->addColumn( - 'tab_group_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['default' => null], - 'Tab Group Code' -)->addIndex( - $installer->getIdxName( - 'eav_attribute_group', - ['attribute_set_id', 'attribute_group_name'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['attribute_set_id', 'attribute_group_name'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('eav_attribute_group', ['attribute_set_id', 'sort_order']), - ['attribute_set_id', 'sort_order'] -)->addForeignKey( - $installer->getFkName('eav_attribute_group', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), - 'attribute_set_id', - $installer->getTable('eav_attribute_set'), - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Attribute Group' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_entity_attribute' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_attribute') -)->addColumn( - 'entity_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Attribute 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( - 'attribute_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Group Id' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' -)->addIndex( - $installer->getIdxName( - 'eav_entity_attribute', - ['attribute_set_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['attribute_set_id', 'attribute_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName( - 'eav_entity_attribute', - ['attribute_group_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['attribute_group_id', 'attribute_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('eav_entity_attribute', ['attribute_set_id', 'sort_order']), - ['attribute_set_id', 'sort_order'] -)->addIndex( - $installer->getIdxName('eav_entity_attribute', ['attribute_id']), - ['attribute_id'] -)->addForeignKey( - $installer->getFkName('eav_entity_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_entity_attribute', 'attribute_group_id', 'eav_attribute_group', 'attribute_group_id'), - 'attribute_group_id', - $installer->getTable('eav_attribute_group'), - 'attribute_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Entity Attributes' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_attribute_option' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute_option') -)->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Id' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' -)->addIndex( - $installer->getIdxName('eav_attribute_option', ['attribute_id']), - ['attribute_id'] -)->addForeignKey( - $installer->getFkName('eav_attribute_option', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Attribute Option' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_attribute_option_value' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute_option_value') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value Id' -)->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Value' -)->addIndex( - $installer->getIdxName('eav_attribute_option_value', ['option_id']), - ['option_id'] -)->addIndex( - $installer->getIdxName('eav_attribute_option_value', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('eav_attribute_option_value', 'option_id', 'eav_attribute_option', 'option_id'), - 'option_id', - $installer->getTable('eav_attribute_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_attribute_option_value', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Attribute Option Value' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_attribute_label' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute_label') -)->addColumn( - 'attribute_label_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Label Id' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Value' -)->addIndex( - $installer->getIdxName('eav_attribute_label', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('eav_attribute_label', ['attribute_id', 'store_id']), - ['attribute_id', 'store_id'] -)->addForeignKey( - $installer->getFkName('eav_attribute_label', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_attribute_label', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Attribute Label' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_form_type' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_form_type') -)->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Type Id' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => false], - 'Code' -)->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Label' -)->addColumn( - 'is_system', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is System' -)->addColumn( - 'theme', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => true], - 'Theme' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' -)->addIndex( - $installer->getIdxName( - 'eav_form_type', - ['code', 'theme', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['code', 'theme', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('eav_form_type', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('eav_form_type', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Form Type' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_form_type_entity' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_form_type_entity') -)->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Type Id' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Type Id' -)->addIndex( - $installer->getIdxName('eav_form_type_entity', ['entity_type_id']), - ['entity_type_id'] -)->addForeignKey( - $installer->getFkName('eav_form_type_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_form_type_entity', 'type_id', 'eav_form_type', 'type_id'), - 'type_id', - $installer->getTable('eav_form_type'), - 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Form Type Entity' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_form_fieldset' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_form_fieldset') -)->addColumn( - 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Fieldset Id' -)->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Type Id' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => false], - 'Code' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' -)->addIndex( - $installer->getIdxName( - 'eav_form_fieldset', - ['type_id', 'code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['type_id', 'code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('eav_form_fieldset', 'type_id', 'eav_form_type', 'type_id'), - 'type_id', - $installer->getTable('eav_form_type'), - 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Form Fieldset' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_form_fieldset_label' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_form_fieldset_label') -)->addColumn( - 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Fieldset Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store Id' -)->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Label' -)->addIndex( - $installer->getIdxName('eav_form_fieldset_label', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('eav_form_fieldset_label', 'fieldset_id', 'eav_form_fieldset', 'fieldset_id'), - 'fieldset_id', - $installer->getTable('eav_form_fieldset'), - 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_form_fieldset_label', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Form Fieldset Label' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'eav_form_element' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('eav_form_element') -)->addColumn( - 'element_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Element Id' -)->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Type Id' -)->addColumn( - 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Fieldset Id' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Attribute Id' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' -)->addIndex( - $installer->getIdxName( - 'eav_form_element', - ['type_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['type_id', 'attribute_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('eav_form_element', ['fieldset_id']), - ['fieldset_id'] -)->addIndex( - $installer->getIdxName('eav_form_element', ['attribute_id']), - ['attribute_id'] -)->addForeignKey( - $installer->getFkName('eav_form_element', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_form_element', 'fieldset_id', 'eav_form_fieldset', 'fieldset_id'), - 'fieldset_id', - $installer->getTable('eav_form_fieldset'), - 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('eav_form_element', 'type_id', 'eav_form_type', 'type_id'), - 'type_id', - $installer->getTable('eav_form_type'), - 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Eav Form Element' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Email/sql/email_setup/install-2.0.0.php b/app/code/Magento/Email/sql/email_setup/install-2.0.0.php deleted file mode 100644 index 6061efbdfad19..0000000000000 --- a/app/code/Magento/Email/sql/email_setup/install-2.0.0.php +++ /dev/null @@ -1,105 +0,0 @@ -getConnection()->newTable( - $installer->getTable('email_template') -)->addColumn( - 'template_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Template Id' -)->addColumn( - 'template_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 150, - ['nullable' => false], - 'Template Name' -)->addColumn( - 'template_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Template Content' -)->addColumn( - 'template_styles', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Templste Styles' -)->addColumn( - 'template_type', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Template Type' -)->addColumn( - 'template_subject', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - ['nullable' => false], - 'Template Subject' -)->addColumn( - 'template_sender_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Template Sender Name' -)->addColumn( - 'template_sender_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Template Sender Email' -)->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Date of Template Creation' -)->addColumn( - 'modified_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Date of Template Modification' -)->addColumn( - 'orig_template_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Original Template Code' -)->addColumn( - 'orig_template_variables', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Original Template Variables' -)->addIndex( - $installer->getIdxName( - 'email_template', - ['template_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['template_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('email_template', ['added_at']), - ['added_at'] -)->addIndex( - $installer->getIdxName('email_template', ['modified_at']), - ['modified_at'] -)->setComment( - 'Email Templates' -); - -$installer->getConnection()->createTable($table); diff --git a/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php b/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php deleted file mode 100644 index 689a3116d11d3..0000000000000 --- a/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php +++ /dev/null @@ -1,91 +0,0 @@ - [ - 'EUROPEFIRSTINTERNATIONALPRIORITY' => 'EUROPE_FIRST_INTERNATIONAL_PRIORITY', - 'FEDEX1DAYFREIGHT' => 'FEDEX_1_DAY_FREIGHT', - 'FEDEX2DAYFREIGHT' => 'FEDEX_2_DAY_FREIGHT', - 'FEDEX2DAY' => 'FEDEX_2_DAY', - 'FEDEX3DAYFREIGHT' => 'FEDEX_3_DAY_FREIGHT', - 'FEDEXEXPRESSSAVER' => 'FEDEX_EXPRESS_SAVER', - 'FEDEXGROUND' => 'FEDEX_GROUND', - 'FIRSTOVERNIGHT' => 'FIRST_OVERNIGHT', - 'GROUNDHOMEDELIVERY' => 'GROUND_HOME_DELIVERY', - 'INTERNATIONALECONOMY' => 'INTERNATIONAL_ECONOMY', - 'INTERNATIONALECONOMY FREIGHT' => 'INTERNATIONAL_ECONOMY_FREIGHT', - 'INTERNATIONALFIRST' => 'INTERNATIONAL_FIRST', - 'INTERNATIONALGROUND' => 'INTERNATIONAL_GROUND', - 'INTERNATIONALPRIORITY' => 'INTERNATIONAL_PRIORITY', - 'INTERNATIONALPRIORITY FREIGHT' => 'INTERNATIONAL_PRIORITY_FREIGHT', - 'PRIORITYOVERNIGHT' => 'PRIORITY_OVERNIGHT', - 'SMARTPOST' => 'SMART_POST', - 'STANDARDOVERNIGHT' => 'STANDARD_OVERNIGHT', - 'FEDEXFREIGHT' => 'FEDEX_FREIGHT', - 'FEDEXNATIONALFREIGHT' => 'FEDEX_NATIONAL_FREIGHT', - ], - 'dropoff' => [ - 'REGULARPICKUP' => 'REGULAR_PICKUP', - 'REQUESTCOURIER' => 'REQUEST_COURIER', - 'DROPBOX' => 'DROP_BOX', - 'BUSINESSSERVICECENTER' => 'BUSINESS_SERVICE_CENTER', - 'STATION' => 'STATION', - ], - 'packaging' => [ - 'FEDEXENVELOPE' => 'FEDEX_ENVELOPE', - 'FEDEXPAK' => 'FEDEX_PAK', - 'FEDEXBOX' => 'FEDEX_BOX', - 'FEDEXTUBE' => 'FEDEX_TUBE', - 'FEDEX10KGBOX' => 'FEDEX_10KG_BOX', - 'FEDEX25KGBOX' => 'FEDEX_25KG_BOX', - 'YOURPACKAGING' => 'YOUR_PACKAGING', - ], -]; - -/* @var $installer \Magento\Framework\Setup\ModuleDataResourceInterface */ -$installer = $this; -$configDataTable = $installer->getTable('core_config_data'); -$conn = $installer->getConnection(); - -$select = $conn->select()->from( - $configDataTable -)->where( - 'path IN (?)', - [ - 'carriers/fedex/packaging', - 'carriers/fedex/dropoff', - 'carriers/fedex/free_method', - 'carriers/fedex/allowed_methods' - ] -); -$mapsOld = $conn->fetchAll($select); -foreach ($mapsOld as $mapOld) { - $mapNew = ''; - if (stripos($mapOld['path'], 'packaging') && isset($codes['packaging'][$mapOld['value']])) { - $mapNew = $codes['packaging'][$mapOld['value']]; - } elseif (stripos($mapOld['path'], 'dropoff') && isset($codes['dropoff'][$mapOld['value']])) { - $mapNew = $codes['dropoff'][$mapOld['value']]; - } elseif (stripos($mapOld['path'], 'free_method') && isset($codes['method'][$mapOld['value']])) { - $mapNew = $codes['method'][$mapOld['value']]; - } elseif (stripos($mapOld['path'], 'allowed_methods')) { - foreach (explode(',', $mapOld['value']) as $shippingMethod) { - if (isset($codes['method'][$shippingMethod])) { - $mapNew[] = $codes['method'][$shippingMethod]; - } else { - $mapNew[] = $shippingMethod; - } - } - $mapNew = implode($mapNew, ','); - } else { - continue; - } - - if (!empty($mapNew) && $mapNew != $mapOld['value']) { - $whereConfigId = $conn->quoteInto('config_id = ?', $mapOld['config_id']); - $conn->update($configDataTable, ['value' => $mapNew], $whereConfigId); - } -} diff --git a/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php b/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php deleted file mode 100644 index e3bc0351c090c..0000000000000 --- a/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-2.0.0.php +++ /dev/null @@ -1,52 +0,0 @@ -startSetup(); - -/** - * Create table 'gift_message' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('gift_message') -)->addColumn( - 'gift_message_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'GiftMessage Id' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer id' -)->addColumn( - 'sender', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sender' -)->addColumn( - 'recipient', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Recipient' -)->addColumn( - 'message', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'Message' -)->setComment( - 'Gift Message' -); - -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.php b/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.php deleted file mode 100644 index c08f3ec52c90a..0000000000000 --- a/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.php +++ /dev/null @@ -1,74 +0,0 @@ -startSetup(); - -/** - * Create table 'googleoptimizer_code' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('googleoptimizer_code')) - ->addColumn( - 'code_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Google experiment code id' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Optimized entity id product id or catalog id' - ) - ->addColumn( - 'entity_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Optimized entity type' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store id' - ) - ->addColumn( - 'experiment_script', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Google experiment script' - ) - ->addIndex( - $installer->getIdxName( - 'googleoptimizer_code', - ['store_id', 'entity_id', 'entity_type'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['store_id', 'entity_id', 'entity_type'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('googleoptimizer_code', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Google Experiment code'); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-2.0.0.php b/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-2.0.0.php deleted file mode 100644 index a7d60a64bafc7..0000000000000 --- a/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-2.0.0.php +++ /dev/null @@ -1,179 +0,0 @@ -startSetup(); - -$connection = $installer->getConnection(); - -$table = $connection->newTable($this->getTable('googleshopping_types')) - ->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Type ID' - ) - ->addColumn( - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Attribute Set Id' - ) - ->addColumn( - 'target_country', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - ['nullable' => false, 'default' => 'US'], - 'Target country' - ) - ->addColumn( - 'category', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Google product category' - ) - ->addForeignKey( - $installer->getFkName('googleshopping_types', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), - 'attribute_set_id', - $this->getTable('eav_attribute_set'), - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $installer->getIdxName( - 'googleshopping_types', - ['attribute_set_id', 'target_country'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['attribute_set_id', 'target_country'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->setComment('Google Content Item Types link Attribute Sets'); -$installer->getConnection()->createTable($table); - -$table = $connection->newTable($this->getTable('googleshopping_items')) - ->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'unsigned' => true, 'primary' => true], - 'Item Id' - ) - ->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true, 'default' => 0], - 'Type Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Product Id' - ) - ->addColumn( - 'gcontent_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Google Content Item Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'unsigned' => true], - 'Store Id' - ) - ->addColumn( - 'published', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Published date' - ) - ->addColumn( - 'expires', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Expires date' - ) - ->addForeignKey( - $installer->getFkName('googleshopping_items', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $this->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('googleshopping_items', 'store_id', 'store', 'store_id'), - 'store_id', - $this->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $installer->getIdxName('googleshopping_items', ['product_id', 'store_id']), - ['product_id', 'store_id'] - ) - ->setComment('Google Content Items Products'); -$installer->getConnection()->createTable($table); - -$table = $connection->newTable($this->getTable('googleshopping_attributes')) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 10, - ['identity' => true, 'nullable' => false, 'unsigned' => true, 'primary' => true], - 'Id' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'unsigned' => true], - 'Attribute Id' - ) - ->addColumn( - 'gcontent_attribute', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Google Content Attribute' - ) - ->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Type Id' - ) - ->addForeignKey( - $installer->getFkName('googleshopping_attributes', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $this->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('googleshopping_attributes', 'type_id', 'googleshopping_types', 'type_id'), - 'type_id', - $this->getTable('googleshopping_types'), - 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Google Content Attributes link Product Attributes'); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/ImportExport/sql/importexport_setup/install-2.0.0.php b/app/code/Magento/ImportExport/sql/importexport_setup/install-2.0.0.php deleted file mode 100644 index 1796f22c67cc5..0000000000000 --- a/app/code/Magento/ImportExport/sql/importexport_setup/install-2.0.0.php +++ /dev/null @@ -1,47 +0,0 @@ -startSetup(); - -/** - * Create table 'importexport_importdata' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('importexport_importdata')) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - ) - ->addColumn( - 'entity', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false], - 'Entity' - ) - ->addColumn( - 'behavior', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 10, - ['nullable' => false, 'default' => 'append'], - 'Behavior' - ) - ->addColumn( - 'data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '4G', - ['default' => false], - 'Data' - ) - ->setComment('Import Data Table'); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Indexer/sql/indexer_setup/install-2.0.0.php b/app/code/Magento/Indexer/sql/indexer_setup/install-2.0.0.php deleted file mode 100644 index 5254399e0a22c..0000000000000 --- a/app/code/Magento/Indexer/sql/indexer_setup/install-2.0.0.php +++ /dev/null @@ -1,115 +0,0 @@ -startSetup(); - -/** - * Create table 'indexer_state' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('indexer_state')) - ->addColumn( - 'state_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Indexer State Id' - ) - ->addColumn( - 'indexer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Indexer Id' - ) - ->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['default' => 'invalid'], - 'Indexer Status' - ) - ->addColumn( - 'updated', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Indexer Status' - ) - ->addIndex( - $installer->getIdxName('indexer_state', ['indexer_id']), - ['indexer_id'] - ) - ->setComment('Indexer State'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'mview_state' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('mview_state')) - ->addColumn( - 'state_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [ - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], - 'View State Id' - ) - ->addColumn( - 'view_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'View Id' - ) - ->addColumn( - 'mode', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['default' => 'disabled'], - 'View Mode' - ) - ->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['default' => 'idle'], - 'View Status' - ) - ->addColumn( - 'updated', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'View updated time' - ) - ->addColumn( - 'version_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'View Version Id' - ) - ->addIndex( - $installer->getIdxName('mview_state', ['view_id']), - ['view_id'] - ) - ->addIndex( - $installer->getIdxName('mview_state', ['mode']), - ['mode'] - ) - ->setComment('View State'); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php b/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php deleted file mode 100644 index 4a3b4c27f0d1f..0000000000000 --- a/app/code/Magento/Integration/sql/integration_setup/install-2.0.0.php +++ /dev/null @@ -1,356 +0,0 @@ -startSetup(); - -/** - * Create table 'oauth_consumer' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('oauth_consumer') -)->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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Updated At' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Name of consumer' -)->addColumn( - 'key', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Key code' -)->addColumn( - 'secret', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Secret code' -)->addColumn( - 'callback_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Callback URL' -)->addColumn( - 'rejected_callback_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Rejected callback URL' -)->addIndex( - $installer->getIdxName( - $installer->getTable('oauth_consumer'), - ['key'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['key'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName( - $installer->getTable('oauth_consumer'), - ['secret'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['secret'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('oauth_consumer', ['created_at']), - ['created_at'] -)->addIndex( - $installer->getIdxName('oauth_consumer', ['updated_at']), - ['updated_at'] -)->setComment( - 'OAuth Consumers' -); -$installer->getConnection()->createTable($table); - -$adminTable = $installer->getTable('admin_user'); -$customerTable = $installer->getTable('customer_entity'); - -/** - * Create table 'oauth_token' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('oauth_token') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' -)->addColumn( - 'consumer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true], - 'Oauth Consumer ID' -)->addColumn( - 'admin_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true], - 'Admin user ID' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true], - 'Customer user ID' -)->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['nullable' => false], - 'Token Type' -)->addColumn( - 'token', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Token' -)->addColumn( - 'secret', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Token Secret' -)->addColumn( - 'verifier', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true], - 'Token Verifier' -)->addColumn( - 'callback_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Token Callback URL' -)->addColumn( - 'revoked', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Is Token revoked' -)->addColumn( - 'authorized', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Is Token authorized' -)->addColumn( - 'user_type', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'User type' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], - 'Token creation timestamp' -)->addIndex( - $installer->getIdxName( - $installer->getTable('oauth_token'), - ['consumer_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX - ), - ['consumer_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX] -)->addIndex( - $installer->getIdxName( - $installer->getTable('oauth_token'), - ['token'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['token'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('oauth_token', 'admin_id', 'admin_user', 'user_id'), - 'admin_id', - $installer->getTable('admin_user'), - 'user_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('oauth_token', 'consumer_id', 'oauth_consumer', 'entity_id'), - 'consumer_id', - $installer->getTable('oauth_consumer'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('oauth_token', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'OAuth Tokens' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'oauth_nonce' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('oauth_nonce') -)->addColumn( - 'nonce', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Nonce String' -)->addColumn( - 'timestamp', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 10, - ['unsigned' => true, 'nullable' => false], - 'Nonce Timestamp' -)->addColumn( - 'consumer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Consumer ID' -)->addIndex( - $installer->getIdxName( - $installer->getTable('oauth_nonce'), - ['nonce', 'consumer_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['nonce', 'consumer_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('oauth_nonce', 'consumer_id', 'oauth_consumer', 'entity_id'), - 'consumer_id', - $installer->getTable('oauth_consumer'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'OAuth Nonce' -)->setOption( - 'type', - 'MyISAM' -); -$installer->getConnection()->createTable($table); - -$table = $installer->getConnection()->newTable( - $installer->getTable('integration') -)->addColumn( - 'integration_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Integration ID' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Integration name is displayed in the admin interface' -)->addColumn( - 'email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Email address of the contact person' -)->addColumn( - 'endpoint', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Endpoint for posting consumer credentials' -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Integration status' -)->addColumn( - 'consumer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Oauth consumer' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Creation Time' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Update Time' -)->addColumn( - 'setup_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Integration type - manual or config file' -)->addColumn( - 'identity_link_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Identity linking Url' -)->addIndex( - $installer->getIdxName( - $installer->getTable('integration'), - ['name'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['name'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName( - $installer->getTable('integration'), - ['consumer_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['consumer_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('integration', 'consumer_id', $installer->getTable('oauth_consumer'), 'entity_id'), - 'consumer_id', - $installer->getTable('oauth_consumer'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -); - -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php b/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php deleted file mode 100644 index 1f99095a925ae..0000000000000 --- a/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php +++ /dev/null @@ -1,17 +0,0 @@ - 1, 'type_code' => 'hour', 'period' => 1, 'period_type' => 'HOUR'], - ['type_id' => 2, 'type_code' => 'day', 'period' => 1, 'period_type' => 'DAY'], -]; - -foreach ($data as $bind) { - $installer->getConnection()->insertForce($installer->getTable('log_summary_type'), $bind); -} diff --git a/app/code/Magento/Log/sql/log_setup/install-2.0.0.php b/app/code/Magento/Log/sql/log_setup/install-2.0.0.php deleted file mode 100644 index 7f78dbffc920f..0000000000000 --- a/app/code/Magento/Log/sql/log_setup/install-2.0.0.php +++ /dev/null @@ -1,387 +0,0 @@ -startSetup(); - -/** - * Create table 'log_customer' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('log_customer') -)->addColumn( - 'log_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Log ID' -)->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true], - 'Visitor ID' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Customer ID' -)->addColumn( - 'login_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Login Time' -)->addColumn( - 'logout_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Logout Time' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store ID' -)->addIndex( - $installer->getIdxName('log_customer', ['visitor_id']), - ['visitor_id'] -)->setComment( - 'Log Customers Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'log_quote' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('log_quote') -)->addColumn( - 'quote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Quote ID' -)->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true], - 'Visitor ID' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Creation Time' -)->addColumn( - 'deleted_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Deletion Time' -)->setComment( - 'Log Quotes Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'log_summary' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('log_summary') -)->addColumn( - 'summary_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Summary ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store ID' -)->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Type ID' -)->addColumn( - 'visitor_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Visitor Count' -)->addColumn( - 'customer_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Customer Count' -)->addColumn( - 'add_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Date' -)->setComment( - 'Log Summary Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'log_summary_type' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('log_summary_type') -)->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Type ID' -)->addColumn( - 'type_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => true, 'default' => null], - 'Type Code' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Period' -)->addColumn( - 'period_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 6, - ['nullable' => false, 'default' => 'MINUTE'], - 'Period Type' -)->setComment( - 'Log Summary Types Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'log_url' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('log_url') -)->addColumn( - 'url_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'URL ID' -)->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true], - 'Visitor ID' -)->addColumn( - 'visit_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Visit Time' -)->addIndex( - $installer->getIdxName('log_url', ['visitor_id']), - ['visitor_id'] -)->setComment( - 'Log URL Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'log_url_info' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('log_url_info') -)->addColumn( - 'url_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'URL ID' -)->addColumn( - 'url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'URL' -)->addColumn( - 'referer', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Referrer' -)->setComment( - 'Log URL Info Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'log_visitor' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('log_visitor') -)->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Visitor ID' -)->addColumn( - 'first_visit_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'First Visit Time' -)->addColumn( - 'last_visit_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Last Visit Time' -)->addColumn( - 'last_url_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Last URL ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store ID' -)->setComment( - 'Log Visitors Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'log_visitor_info' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('log_visitor_info') -)->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Visitor ID' -)->addColumn( - 'http_referer', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'HTTP Referrer' -)->addColumn( - 'http_user_agent', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'HTTP User-Agent' -)->addColumn( - 'http_accept_charset', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'HTTP Accept-Charset' -)->addColumn( - 'http_accept_language', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'HTTP Accept-Language' -)->addColumn( - 'server_addr', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - [], - 'Server Address' -)->addColumn( - 'remote_addr', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - [], - 'Remote Address' -)->setComment( - 'Log Visitor Info Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'log_visitor_online' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('log_visitor_online') -)->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Visitor ID' -)->addColumn( - 'visitor_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 1, - ['nullable' => false], - 'Visitor Type' -)->addColumn( - 'remote_addr', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['nullable' => false], - 'Remote Address' -)->addColumn( - 'first_visit_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'First Visit Time' -)->addColumn( - 'last_visit_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Last Visit Time' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer ID' -)->addColumn( - 'last_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Last URL' -)->addIndex( - $installer->getIdxName('log_visitor_online', ['visitor_type']), - ['visitor_type'] -)->addIndex( - $installer->getIdxName('log_visitor_online', ['first_visit_at', 'last_visit_at']), - ['first_visit_at', 'last_visit_at'] -)->addIndex( - $installer->getIdxName('log_visitor_online', ['customer_id']), - ['customer_id'] -)->setComment( - 'Log Visitor Online Table' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Newsletter/sql/newsletter_setup/install-2.0.0.php b/app/code/Magento/Newsletter/sql/newsletter_setup/install-2.0.0.php deleted file mode 100644 index bd04c32f82073..0000000000000 --- a/app/code/Magento/Newsletter/sql/newsletter_setup/install-2.0.0.php +++ /dev/null @@ -1,455 +0,0 @@ -startSetup(); - -/** - * Create table 'newsletter_subscriber' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_subscriber')) - ->addColumn( - 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Subscriber Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Store Id' - ) - ->addColumn( - 'change_status_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Change Status At' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Id' - ) - ->addColumn( - 'subscriber_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 150, - ['nullable' => true, 'default' => null], - 'Subscriber Email' - ) - ->addColumn( - 'subscriber_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Subscriber Status' - ) - ->addColumn( - 'subscriber_confirm_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['default' => 'NULL'], - 'Subscriber Confirm Code' - ) - ->addIndex( - $installer->getIdxName('newsletter_subscriber', ['customer_id']), - ['customer_id'] - ) - ->addIndex( - $installer->getIdxName('newsletter_subscriber', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('newsletter_subscriber', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Newsletter Subscriber'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'newsletter_template' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_template')) - ->addColumn( - 'template_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Template Id' - ) - ->addColumn( - 'template_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 150, - [], - 'Template Code' - ) - ->addColumn( - 'template_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Template Text' - ) - ->addColumn( - 'template_text_preprocessed', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Template Text Preprocessed' - ) - ->addColumn( - 'template_styles', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Template Styles' - ) - ->addColumn( - 'template_type', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Template Type' - ) - ->addColumn( - 'template_subject', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Template Subject' - ) - ->addColumn( - 'template_sender_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Template Sender Name' - ) - ->addColumn( - 'template_sender_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Template Sender Email' - ) - ->addColumn( - 'template_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '1'], - 'Template Actual' - ) - ->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Added At' - ) - ->addColumn( - 'modified_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Modified At' - ) - ->addIndex( - $installer->getIdxName('newsletter_template', ['template_actual']), - ['template_actual'] - ) - ->addIndex( - $installer->getIdxName('newsletter_template', ['added_at']), - ['added_at'] - ) - ->addIndex( - $installer->getIdxName('newsletter_template', ['modified_at']), - ['modified_at'] - ) - ->setComment('Newsletter Template'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'newsletter_queue' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_queue')) - ->addColumn( - 'queue_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Queue Id' - ) - ->addColumn( - 'template_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Template Id' - ) - ->addColumn( - 'newsletter_type', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Newsletter Type' - ) - ->addColumn( - 'newsletter_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Newsletter Text' - ) - ->addColumn( - 'newsletter_styles', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Newsletter Styles' - ) - ->addColumn( - 'newsletter_subject', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Newsletter Subject' - ) - ->addColumn( - 'newsletter_sender_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Newsletter Sender Name' - ) - ->addColumn( - 'newsletter_sender_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Newsletter Sender Email' - ) - ->addColumn( - 'queue_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Queue Status' - ) - ->addColumn( - 'queue_start_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Queue Start At' - ) - ->addColumn( - 'queue_finish_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Queue Finish At' - ) - ->addIndex( - $installer->getIdxName('newsletter_queue', ['template_id']), - ['template_id'] - ) - ->addForeignKey( - $installer->getFkName('newsletter_queue', 'template_id', 'newsletter_template', 'template_id'), - 'template_id', - $installer->getTable('newsletter_template'), - 'template_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Newsletter Queue'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'newsletter_queue_link' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_queue_link')) - ->addColumn( - 'queue_link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Queue Link Id' - ) - ->addColumn( - 'queue_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Queue Id' - ) - ->addColumn( - 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Subscriber Id' - ) - ->addColumn( - 'letter_sent_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Letter Sent At' - ) - ->addIndex( - $installer->getIdxName('newsletter_queue_link', ['subscriber_id']), - ['subscriber_id'] - ) - ->addIndex( - $installer->getIdxName('newsletter_queue_link', ['queue_id', 'letter_sent_at']), - ['queue_id', 'letter_sent_at'] - ) - ->addForeignKey( - $installer->getFkName('newsletter_queue_link', 'queue_id', 'newsletter_queue', 'queue_id'), - 'queue_id', - $installer->getTable('newsletter_queue'), - 'queue_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('newsletter_queue_link', 'subscriber_id', 'newsletter_subscriber', 'subscriber_id'), - 'subscriber_id', - $installer->getTable('newsletter_subscriber'), - 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Newsletter Queue Link'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'newsletter_queue_store_link' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_queue_store_link')) - ->addColumn( - 'queue_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Queue Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Store Id' - ) - ->addIndex( - $installer->getIdxName('newsletter_queue_store_link', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('newsletter_queue_store_link', 'queue_id', 'newsletter_queue', 'queue_id'), - 'queue_id', - $installer->getTable('newsletter_queue'), - 'queue_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('newsletter_queue_store_link', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Newsletter Queue Store Link'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'newsletter_problem' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_problem')) - ->addColumn( - 'problem_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Problem Id' - ) - ->addColumn( - 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Subscriber Id' - ) - ->addColumn( - 'queue_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Queue Id' - ) - ->addColumn( - 'problem_error_code', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Problem Error Code' - ) - ->addColumn( - 'problem_error_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Problem Error Text' - ) - ->addIndex( - $installer->getIdxName('newsletter_problem', ['subscriber_id']), - ['subscriber_id'] - ) - ->addIndex( - $installer->getIdxName('newsletter_problem', ['queue_id']), - ['queue_id'] - ) - ->addForeignKey( - $installer->getFkName('newsletter_problem', 'queue_id', 'newsletter_queue', 'queue_id'), - 'queue_id', - $installer->getTable('newsletter_queue'), - 'queue_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('newsletter_problem', 'subscriber_id', 'newsletter_subscriber', 'subscriber_id'), - 'subscriber_id', - $installer->getTable('newsletter_subscriber'), - 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Newsletter Problems'); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php deleted file mode 100644 index 309dd7f33218b..0000000000000 --- a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php +++ /dev/null @@ -1,125 +0,0 @@ -startSetup(); - -/** - * Create table 'shipping_tablerate' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('shipping_tablerate') -)->addColumn( - 'pk', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Primary key' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Website Id' -)->addColumn( - 'dest_country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 4, - ['nullable' => false, 'default' => '0'], - 'Destination coutry ISO/2 or ISO/3 code' -)->addColumn( - 'dest_region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Destination Region Id' -)->addColumn( - 'dest_zip', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 10, - ['nullable' => false, 'default' => '*'], - 'Destination Post Code (Zip)' -)->addColumn( - 'condition_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - ['nullable' => false], - 'Rate Condition name' -)->addColumn( - 'condition_value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Rate condition value' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' -)->addColumn( - 'cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Cost' -)->addIndex( - $installer->getIdxName( - 'shipping_tablerate', - ['website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->setComment( - 'Shipping Tablerate' -); -$installer->getConnection()->createTable($table); - -$installer->getConnection()->addColumn( - $installer->getTable('salesrule'), - 'simple_free_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Simple Free Shipping' -); -$installer->getConnection()->addColumn( - $installer->getTable('sales_order_item'), - 'free_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Free Shipping' -); -$installer->getConnection()->addColumn( - $installer->getTable('quote_address'), - 'free_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Free Shipping' -); -$installer->getConnection()->addColumn( - $installer->getTable('quote_item'), - 'free_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Free Shipping' -); -$installer->getConnection()->addColumn( - $installer->getTable('quote_address_item'), - 'free_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Free Shipping' -); - -$installer->endSetup(); diff --git a/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php b/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php deleted file mode 100644 index 550caa7e2b7c6..0000000000000 --- a/app/code/Magento/Persistent/sql/persistent_setup/install-2.0.0.php +++ /dev/null @@ -1,96 +0,0 @@ -startSetup(); - -/** - * Create table 'persistent_session' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('persistent_session') -)->addColumn( - 'persistent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'primary' => true, 'nullable' => false, 'unsigned' => true], - 'Session id' -)->addColumn( - 'key', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false], - 'Unique cookie key' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer id' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website ID' -)->addColumn( - 'info', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Session Data' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' -)->addIndex( - $installer->getIdxName('persistent_session', ['key']), - ['key'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('persistent_session', ['customer_id']), - ['customer_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('persistent_session', ['updated_at']), - ['updated_at'] -)->addForeignKey( - $installer->getFkName('persistent_session', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('persistent_session', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Persistent Session' -); - -$installer->getConnection()->createTable($table); - -/** - * Alter quote table with is_persistent flag - * - */ -$installer->getConnection()->addColumn( - $installer->getTable('quote'), - 'is_persistent', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 'unsigned' => true, - 'default' => '0', - 'comment' => 'Is Quote Persistent' - ] -); - -$installer->endSetup(); diff --git a/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php b/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php deleted file mode 100644 index df3d7d81c69ee..0000000000000 --- a/app/code/Magento/ProductAlert/sql/productalert_setup/install-2.0.0.php +++ /dev/null @@ -1,199 +0,0 @@ - - */ - -/* @var $installer \Magento\Framework\Setup\ModuleSchemaResourceInterface */ -$installer = $this; - -$installer->startSetup(); -/** - * Create table 'product_alert_price' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('product_alert_price') -)->addColumn( - 'alert_price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product alert price id' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer id' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product id' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price amount' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website id' -)->addColumn( - 'add_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Product alert add date' -)->addColumn( - 'last_send_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Product alert last send date' -)->addColumn( - 'send_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product alert send count' -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product alert status' -)->addIndex( - $installer->getIdxName('product_alert_price', ['customer_id']), - ['customer_id'] -)->addIndex( - $installer->getIdxName('product_alert_price', ['product_id']), - ['product_id'] -)->addIndex( - $installer->getIdxName('product_alert_price', ['website_id']), - ['website_id'] -)->addForeignKey( - $installer->getFkName('product_alert_price', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('product_alert_price', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('product_alert_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Product Alert Price' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'product_alert_stock' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('product_alert_stock') -)->addColumn( - 'alert_stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product alert stock id' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer id' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product id' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website id' -)->addColumn( - 'add_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Product alert add date' -)->addColumn( - 'send_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Product alert send date' -)->addColumn( - 'send_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Send Count' -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product alert status' -)->addIndex( - $installer->getIdxName('product_alert_stock', ['customer_id']), - ['customer_id'] -)->addIndex( - $installer->getIdxName('product_alert_stock', ['product_id']), - ['product_id'] -)->addIndex( - $installer->getIdxName('product_alert_stock', ['website_id']), - ['website_id'] -)->addForeignKey( - $installer->getFkName('product_alert_stock', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('product_alert_stock', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('product_alert_stock', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Product Alert Stock' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Quote/sql/quote_setup/install-2.0.0.php b/app/code/Magento/Quote/sql/quote_setup/install-2.0.0.php deleted file mode 100644 index b33154f4c7688..0000000000000 --- a/app/code/Magento/Quote/sql/quote_setup/install-2.0.0.php +++ /dev/null @@ -1,1534 +0,0 @@ -startSetup(); - -/** - * Create table 'quote' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('quote') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store 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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' -)->addColumn( - 'converted_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Converted At' -)->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '1'], - 'Is Active' -)->addColumn( - 'is_virtual', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Is Virtual' -)->addColumn( - 'is_multi_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Is Multi Shipping' -)->addColumn( - 'items_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Items Count' -)->addColumn( - 'items_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Items Qty' -)->addColumn( - 'orig_order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Orig Order Id' -)->addColumn( - 'store_to_base_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Store To Base Rate' -)->addColumn( - 'store_to_quote_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Store To Quote Rate' -)->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Base Currency Code' -)->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Store Currency Code' -)->addColumn( - 'quote_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Quote Currency Code' -)->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Grand Total' -)->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Grand Total' -)->addColumn( - 'checkout_method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Checkout Method' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Customer Id' -)->addColumn( - 'customer_tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Customer Tax Class Id' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Customer Group Id' -)->addColumn( - 'customer_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Email' -)->addColumn( - 'customer_prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Customer Prefix' -)->addColumn( - 'customer_firstname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Firstname' -)->addColumn( - 'customer_middlename', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Customer Middlename' -)->addColumn( - 'customer_lastname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Lastname' -)->addColumn( - 'customer_suffix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Customer Suffix' -)->addColumn( - 'customer_dob', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Customer Dob' -)->addColumn( - 'customer_note', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Note' -)->addColumn( - 'customer_note_notify', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '1'], - 'Customer Note Notify' -)->addColumn( - 'customer_is_guest', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Customer Is Guest' -)->addColumn( - 'remote_ip', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Remote Ip' -)->addColumn( - 'applied_rule_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Applied Rule Ids' -)->addColumn( - 'reserved_order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => true], - 'Reserved Order Id' -)->addColumn( - 'password_hash', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Password Hash' -)->addColumn( - 'coupon_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Coupon Code' -)->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Global Currency Code' -)->addColumn( - 'base_to_global_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Global Rate' -)->addColumn( - 'base_to_quote_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Quote Rate' -)->addColumn( - 'customer_taxvat', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Taxvat' -)->addColumn( - 'customer_gender', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Gender' -)->addColumn( - 'subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal' -)->addColumn( - 'base_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal' -)->addColumn( - 'subtotal_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal With Discount' -)->addColumn( - 'base_subtotal_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal With Discount' -)->addColumn( - 'is_changed', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Is Changed' -)->addColumn( - 'trigger_recollect', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Trigger Recollect' -)->addColumn( - 'ext_shipping_info', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Ext Shipping Info' -)->addIndex( - $installer->getIdxName('quote', ['customer_id', 'store_id', 'is_active']), - ['customer_id', 'store_id', 'is_active'] -)->addIndex( - $installer->getIdxName('quote', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('quote', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Quote' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'quote_address' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('quote_address') -)->addColumn( - 'address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Address Id' -)->addColumn( - 'quote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Quote 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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer Id' -)->addColumn( - 'save_in_address_book', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['default' => '0'], - 'Save In Address Book' -)->addColumn( - 'customer_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer Address Id' -)->addColumn( - 'address_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Address Type' -)->addColumn( - 'email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Email' -)->addColumn( - 'prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Prefix' -)->addColumn( - 'firstname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Firstname' -)->addColumn( - 'middlename', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Middlename' -)->addColumn( - 'lastname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Lastname' -)->addColumn( - 'suffix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Suffix' -)->addColumn( - 'company', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Company' -)->addColumn( - 'street', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Street' -)->addColumn( - 'city', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'City' -)->addColumn( - 'region', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Region' -)->addColumn( - 'region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Region Id' -)->addColumn( - 'postcode', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Postcode' -)->addColumn( - 'country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Country Id' -)->addColumn( - 'telephone', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Phone Number' -)->addColumn( - 'fax', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Fax' -)->addColumn( - 'same_as_billing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Same As Billing' -)->addColumn( - 'collect_shipping_rates', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Collect Shipping Rates' -)->addColumn( - 'shipping_method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Method' -)->addColumn( - 'shipping_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Description' -)->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Weight' -)->addColumn( - 'subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Subtotal' -)->addColumn( - 'base_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Subtotal' -)->addColumn( - 'subtotal_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Subtotal With Discount' -)->addColumn( - 'base_subtotal_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Subtotal With Discount' -)->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Tax Amount' -)->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Tax Amount' -)->addColumn( - 'shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Shipping Amount' -)->addColumn( - 'base_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Shipping Amount' -)->addColumn( - 'shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Tax Amount' -)->addColumn( - 'base_shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Tax Amount' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount' -)->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Discount Amount' -)->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Grand Total' -)->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Grand Total' -)->addColumn( - 'customer_notes', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Customer Notes' -)->addColumn( - 'applied_taxes', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Applied Taxes' -)->addColumn( - 'discount_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Discount Description' -)->addColumn( - 'shipping_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Discount Amount' -)->addColumn( - 'base_shipping_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Discount Amount' -)->addColumn( - 'subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Incl Tax' -)->addColumn( - 'base_subtotal_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Total Incl Tax' -)->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' -)->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' -)->addColumn( - 'shipping_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Hidden Tax Amount' -)->addColumn( - 'base_shipping_hidden_tax_amnt', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Hidden Tax Amount' -)->addColumn( - 'shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Incl Tax' -)->addColumn( - 'base_shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Incl Tax' -)->addIndex( - $installer->getIdxName('quote_address', ['quote_id']), - ['quote_id'] -)->addForeignKey( - $installer->getFkName('quote_address', 'quote_id', 'quote', 'entity_id'), - 'quote_id', - $installer->getTable('quote'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Quote Address' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'quote_item' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('quote_item') -)->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Item Id' -)->addColumn( - 'quote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Quote Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Created At' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'parent_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Item Id' -)->addColumn( - 'is_virtual', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Virtual' -)->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' -)->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' -)->addColumn( - 'applied_rule_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Applied Rule Ids' -)->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' -)->addColumn( - 'is_qty_decimal', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Qty Decimal' -)->addColumn( - 'no_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'No Discount' -)->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Weight' -)->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' -)->addColumn( - 'base_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Price' -)->addColumn( - 'custom_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Custom Price' -)->addColumn( - 'discount_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Percent' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Amount' -)->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Discount Amount' -)->addColumn( - 'tax_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Percent' -)->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Amount' -)->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Tax Amount' -)->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Row Total' -)->addColumn( - 'base_row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Row Total' -)->addColumn( - 'row_total_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Row Total With Discount' -)->addColumn( - 'row_weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Row Weight' -)->addColumn( - 'product_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Product Type' -)->addColumn( - 'base_tax_before_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Before Discount' -)->addColumn( - 'tax_before_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Before Discount' -)->addColumn( - 'original_custom_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Original Custom Price' -)->addColumn( - 'redirect_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Redirect Url' -)->addColumn( - 'base_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Cost' -)->addColumn( - 'price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price Incl Tax' -)->addColumn( - 'base_price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price Incl Tax' -)->addColumn( - 'row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total Incl Tax' -)->addColumn( - 'base_row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total Incl Tax' -)->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' -)->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' -)->addIndex( - $installer->getIdxName('quote_item', ['parent_item_id']), - ['parent_item_id'] -)->addIndex( - $installer->getIdxName('quote_item', ['product_id']), - ['product_id'] -)->addIndex( - $installer->getIdxName('quote_item', ['quote_id']), - ['quote_id'] -)->addIndex( - $installer->getIdxName('quote_item', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('quote_item', 'parent_item_id', 'quote_item', 'item_id'), - 'parent_item_id', - $installer->getTable('quote_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('quote_item', 'quote_id', 'quote', 'entity_id'), - 'quote_id', - $installer->getTable('quote'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('quote_item', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Quote Item' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'quote_address_item' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('quote_address_item') -)->addColumn( - 'address_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Address Item Id' -)->addColumn( - 'parent_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Item Id' -)->addColumn( - 'quote_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Quote Address Id' -)->addColumn( - 'quote_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Quote Item 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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' -)->addColumn( - 'applied_rule_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Applied Rule Ids' -)->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' -)->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Weight' -)->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Amount' -)->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Amount' -)->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Row Total' -)->addColumn( - 'base_row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Row Total' -)->addColumn( - 'row_total_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Row Total With Discount' -)->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Discount Amount' -)->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Tax Amount' -)->addColumn( - 'row_weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Row Weight' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' -)->addColumn( - 'super_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Super Product Id' -)->addColumn( - 'parent_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Product Id' -)->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' -)->addColumn( - 'image', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Image' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' -)->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' -)->addColumn( - 'is_qty_decimal', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Is Qty Decimal' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' -)->addColumn( - 'discount_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Percent' -)->addColumn( - 'no_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'No Discount' -)->addColumn( - 'tax_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Percent' -)->addColumn( - 'base_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price' -)->addColumn( - 'base_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Cost' -)->addColumn( - 'price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price Incl Tax' -)->addColumn( - 'base_price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price Incl Tax' -)->addColumn( - 'row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total Incl Tax' -)->addColumn( - 'base_row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total Incl Tax' -)->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' -)->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' -)->addIndex( - $installer->getIdxName('quote_address_item', ['quote_address_id']), - ['quote_address_id'] -)->addIndex( - $installer->getIdxName('quote_address_item', ['parent_item_id']), - ['parent_item_id'] -)->addIndex( - $installer->getIdxName('quote_address_item', ['quote_item_id']), - ['quote_item_id'] -)->addForeignKey( - $installer->getFkName( - 'quote_address_item', - 'quote_address_id', - 'quote_address', - 'address_id' - ), - 'quote_address_id', - $installer->getTable('quote_address'), - 'address_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName( - 'quote_address_item', - 'parent_item_id', - 'quote_address_item', - 'address_item_id' - ), - 'parent_item_id', - $installer->getTable('quote_address_item'), - 'address_item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('quote_address_item', 'quote_item_id', 'quote_item', 'item_id'), - 'quote_item_id', - $installer->getTable('quote_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Quote Address Item' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'quote_item_option' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('quote_item_option') -)->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Id' -)->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Item Id' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Product Id' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Code' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Value' -)->addIndex( - $installer->getIdxName('quote_item_option', ['item_id']), - ['item_id'] -)->addForeignKey( - $installer->getFkName('quote_item_option', 'item_id', 'quote_item', 'item_id'), - 'item_id', - $installer->getTable('quote_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Quote Item Option' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'quote_payment' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('quote_payment') -)->addColumn( - 'payment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Payment Id' -)->addColumn( - 'quote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Quote 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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' -)->addColumn( - 'method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Method' -)->addColumn( - 'cc_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Type' -)->addColumn( - 'cc_number_enc', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Number Enc' -)->addColumn( - 'cc_last_4', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Last 4' -)->addColumn( - 'cc_cid_enc', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Cid Enc' -)->addColumn( - 'cc_owner', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Owner' -)->addColumn( - 'cc_exp_month', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['unsigned' => true, 'default' => null, 'nullable' => true], - 'Cc Exp Month' -)->addColumn( - 'cc_exp_year', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Cc Exp Year' -)->addColumn( - 'cc_ss_owner', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Ss Owner' -)->addColumn( - 'cc_ss_start_month', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Cc Ss Start Month' -)->addColumn( - 'cc_ss_start_year', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Cc Ss Start Year' -)->addColumn( - 'po_number', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Po Number' -)->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' -)->addColumn( - 'cc_ss_issue', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Ss Issue' -)->addColumn( - 'additional_information', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Information' -)->addIndex( - $installer->getIdxName('quote_payment', ['quote_id']), - ['quote_id'] -)->addForeignKey( - $installer->getFkName('quote_payment', 'quote_id', 'quote', 'entity_id'), - 'quote_id', - $installer->getTable('quote'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Quote Payment' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'quote_shipping_rate' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('quote_shipping_rate') -)->addColumn( - 'rate_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rate Id' -)->addColumn( - 'address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Address 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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' -)->addColumn( - 'carrier', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Carrier' -)->addColumn( - 'carrier_title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Carrier Title' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Code' -)->addColumn( - 'method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Method' -)->addColumn( - 'method_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Method Description' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' -)->addColumn( - 'error_message', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Error Message' -)->addColumn( - 'method_title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Method Title' -)->addIndex( - $installer->getIdxName('quote_shipping_rate', ['address_id']), - ['address_id'] -)->addForeignKey( - $installer->getFkName('quote_shipping_rate', 'address_id', 'quote_address', 'address_id'), - 'address_id', - $installer->getTable('quote_address'), - 'address_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Quote Shipping Rate' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Reports/sql/reports_setup/install-2.0.0.php b/app/code/Magento/Reports/sql/reports_setup/install-2.0.0.php deleted file mode 100644 index 9636295c0bda9..0000000000000 --- a/app/code/Magento/Reports/sql/reports_setup/install-2.0.0.php +++ /dev/null @@ -1,855 +0,0 @@ -startSetup(); - -/** - * Create table 'report_compared_product_index'. - * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that - * only one record is added when customer/visitor compares same product again. - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('report_compared_product_index')) - ->addColumn( - 'index_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Index Id' - ) - ->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Visitor Id' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer 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], - 'Store Id' - ) - ->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Added At' - ) - ->addIndex( - $installer->getIdxName( - 'report_compared_product_index', - ['visitor_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['visitor_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName( - 'report_compared_product_index', - ['customer_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['customer_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['added_at']), - ['added_at'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Reports Compared Product Index Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'report_viewed_product_index' - * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that - * only one record is added when customer/visitor views same product again. - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('report_viewed_product_index')) - ->addColumn( - 'index_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Index Id' - ) - ->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Visitor Id' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer 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], - 'Store Id' - ) - ->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Added At' - ) - ->addIndex( - $installer->getIdxName( - 'report_viewed_product_index', - ['visitor_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['visitor_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName( - 'report_viewed_product_index', - ['customer_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['customer_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['added_at']), - ['added_at'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Reports Viewed Product Index Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'report_event_types' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('report_event_types')) - ->addColumn( - 'event_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Event Type Id' - ) - ->addColumn( - 'event_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => false], - 'Event Name' - ) - ->addColumn( - 'customer_login', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Login' - ) - ->setComment('Reports Event Type Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'report_event' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('report_event')) - ->addColumn( - 'event_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Event Id' - ) - ->addColumn( - 'logged_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Logged At' - ) - ->addColumn( - 'event_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Event Type Id' - ) - ->addColumn( - 'object_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Object Id' - ) - ->addColumn( - 'subject_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Subject Id' - ) - ->addColumn( - 'subtype', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Subtype' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' - ) - ->addIndex( - $installer->getIdxName('report_event', ['event_type_id']), - ['event_type_id'] - ) - ->addIndex( - $installer->getIdxName('report_event', ['subject_id']), - ['subject_id'] - ) - ->addIndex( - $installer->getIdxName('report_event', ['object_id']), - ['object_id'] - ) - ->addIndex( - $installer->getIdxName('report_event', ['subtype']), - ['subtype'] - ) - ->addIndex( - $installer->getIdxName('report_event', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('report_event', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_event', 'event_type_id', 'report_event_types', 'event_type_id'), - 'event_type_id', - $installer->getTable('report_event_types'), - 'event_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Reports Event Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'report_compared_product_index'. - * MySQL table differs by having unique keys on (customer/visitor, product) columns and is created - * in separate install. - */ -$tableName = $installer->getTable('report_compared_product_index'); -if (!$installer->tableExists($tableName)) { - $table = $installer->getConnection() - ->newTable($tableName) - ->addColumn( - 'index_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Index Id' - ) - ->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Visitor Id' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer 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], - 'Store Id' - ) - ->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Added At' - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['visitor_id', 'product_id']), - ['visitor_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['customer_id', 'product_id']), - ['customer_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['added_at']), - ['added_at'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Reports Compared Product Index Table'); - $installer->getConnection()->createTable($table); -} - -/** - * Create table 'report_viewed_product_index'. - * MySQL table differs by having unique keys on (customer/visitor, product) columns and is created - * in separate install. - */ -$tableName = $installer->getTable('report_viewed_product_index'); -if (!$installer->tableExists($tableName)) { - $table = $installer->getConnection() - ->newTable($tableName) - ->addColumn( - 'index_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Index Id' - ) - ->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Visitor Id' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer 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], - 'Store Id' - ) - ->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Added At' - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['visitor_id', 'product_id']), - ['visitor_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['customer_id', 'product_id']), - ['customer_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['added_at']), - ['added_at'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Reports Viewed Product Index Table'); - $installer->getConnection()->createTable($table); -} - -/** - * Create table 'report_viewed_product_aggregated_daily'. - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('report_viewed_product_aggregated_daily')) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - ) - ->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - ) - ->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' - ) - ->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' - ) - ->addColumn( - 'views_num', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Number of Views' - ) - ->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' - ) - ->addIndex( - $installer->getIdxName( - 'report_viewed_product_aggregated_daily', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_daily', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_daily', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_aggregated_daily', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'report_viewed_product_aggregated_daily', - 'product_id', - 'catalog_product_entity', - 'entity_id' - ), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Most Viewed Products Aggregated Daily'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'report_viewed_product_aggregated_monthly'. - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('report_viewed_product_aggregated_monthly')) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - ) - ->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - ) - ->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' - ) - ->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' - ) - ->addColumn( - 'views_num', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Number of Views' - ) - ->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' - ) - ->addIndex( - $installer->getIdxName( - 'report_viewed_product_aggregated_monthly', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_monthly', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_monthly', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_aggregated_monthly', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'report_viewed_product_aggregated_monthly', - 'product_id', - 'catalog_product_entity', - 'entity_id' - ), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Most Viewed Products Aggregated Monthly'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'report_viewed_product_aggregated_yearly'. - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('report_viewed_product_aggregated_yearly')) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - ) - ->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - ) - ->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' - ) - ->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' - ) - ->addColumn( - 'views_num', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Number of Views' - ) - ->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' - ) - ->addIndex( - $installer->getIdxName( - 'report_viewed_product_aggregated_yearly', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_yearly', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_yearly', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_aggregated_yearly', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'report_viewed_product_aggregated_yearly', - 'product_id', - 'catalog_product_entity', - 'entity_id' - ), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Most Viewed Products Aggregated Yearly'); -$installer->getConnection()->createTable($table); - -/* - * Prepare database for tables install - */ -$installer->endSetup(); diff --git a/app/code/Magento/Review/data/review_setup/data-install-2.0.0.php b/app/code/Magento/Review/data/review_setup/data-install-2.0.0.php deleted file mode 100644 index b31d7a7807d09..0000000000000 --- a/app/code/Magento/Review/data/review_setup/data-install-2.0.0.php +++ /dev/null @@ -1,65 +0,0 @@ - - */ - -/* @var $installer \Magento\Framework\Setup\ModuleDataResourceInterface */ -$installer = $this; - -//Fill table review/review_entity -$reviewEntityCodes = [ - \Magento\Review\Model\Review::ENTITY_PRODUCT_CODE, - \Magento\Review\Model\Review::ENTITY_CUSTOMER_CODE, - \Magento\Review\Model\Review::ENTITY_CATEGORY_CODE, -]; -foreach ($reviewEntityCodes as $entityCode) { - $installer->getConnection()->insert($installer->getTable('review_entity'), ['entity_code' => $entityCode]); -} - -//Fill table review/review_entity -$reviewStatuses = [ - \Magento\Review\Model\Review::STATUS_APPROVED => 'Approved', - \Magento\Review\Model\Review::STATUS_PENDING => 'Pending', - \Magento\Review\Model\Review::STATUS_NOT_APPROVED => 'Not Approved', -]; -foreach ($reviewStatuses as $k => $v) { - $bind = ['status_id' => $k, 'status_code' => $v]; - $installer->getConnection()->insertForce($installer->getTable('review_status'), $bind); -} - -$data = [ - \Magento\Review\Model\Rating::ENTITY_PRODUCT_CODE => [ - ['rating_code' => 'Quality', 'position' => 0], - ['rating_code' => 'Value', 'position' => 0], - ['rating_code' => 'Price', 'position' => 0], - ], - \Magento\Review\Model\Rating::ENTITY_PRODUCT_REVIEW_CODE => [], - \Magento\Review\Model\Rating::ENTITY_REVIEW_CODE => [], -]; - -foreach ($data as $entityCode => $ratings) { - //Fill table rating/rating_entity - $installer->getConnection()->insert($installer->getTable('rating_entity'), ['entity_code' => $entityCode]); - $entityId = $installer->getConnection()->lastInsertId($installer->getTable('rating_entity')); - - foreach ($ratings as $bind) { - //Fill table rating/rating - $bind['entity_id'] = $entityId; - $installer->getConnection()->insert($installer->getTable('rating'), $bind); - - //Fill table rating/rating_option - $ratingId = $installer->getConnection()->lastInsertId($installer->getTable('rating')); - $optionData = []; - for ($i = 1; $i <= 5; $i++) { - $optionData[] = ['rating_id' => $ratingId, 'code' => (string)$i, 'value' => $i, 'position' => $i]; - } - $installer->getConnection()->insertMultiple($installer->getTable('rating_option'), $optionData); - } -} diff --git a/app/code/Magento/Review/sql/review_setup/install-2.0.0.php b/app/code/Magento/Review/sql/review_setup/install-2.0.0.php deleted file mode 100644 index e12309a7e951a..0000000000000 --- a/app/code/Magento/Review/sql/review_setup/install-2.0.0.php +++ /dev/null @@ -1,750 +0,0 @@ -startSetup(); -/** - * Create table 'review_entity' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('review_entity')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Review entity id' - ) - ->addColumn( - 'entity_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Review entity code' - ) - ->setComment('Review entities'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'review_status' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('review_status')) - ->addColumn( - 'status_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Status id' - ) - ->addColumn( - 'status_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Status code' - ) - ->setComment('Review statuses'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'review' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('review')) - ->addColumn( - 'review_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Review id' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Review create date' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity id' - ) - ->addColumn( - 'entity_pk_value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product id' - ) - ->addColumn( - 'status_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Status code' - ) - ->addIndex( - $installer->getIdxName('review', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('review', ['status_id']), - ['status_id'] - ) - ->addIndex( - $installer->getIdxName('review', ['entity_pk_value']), - ['entity_pk_value'] - ) - ->addForeignKey( - $installer->getFkName('review', 'entity_id', 'review_entity', 'entity_id'), - 'entity_id', - $installer->getTable('review_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('review', 'status_id', 'review_status', 'status_id'), - 'status_id', - $installer->getTable('review_status'), - 'status_id', - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION - ) - ->setComment('Review base information'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'review_detail' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('review_detail')) - ->addColumn( - 'detail_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Review detail id' - ) - ->addColumn( - 'review_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Review id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Store id' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Title' - ) - ->addColumn( - 'detail', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Detail description' - ) - ->addColumn( - 'nickname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 128, - ['nullable' => false], - 'User nickname' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer Id' - ) - ->addIndex( - $installer->getIdxName('review_detail', ['review_id']), - ['review_id'] - ) - ->addIndex( - $installer->getIdxName('review_detail', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('review_detail', ['customer_id']), - ['customer_id'] - ) - ->addForeignKey( - $installer->getFkName('review_detail', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('review_detail', 'review_id', 'review', 'review_id'), - 'review_id', - $installer->getTable('review'), - 'review_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('review_detail', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Review detail information'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'review_entity_summary' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('review_entity_summary')) - ->addColumn( - 'primary_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Summary review entity id' - ) - ->addColumn( - 'entity_pk_value', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['nullable' => false, 'default' => '0'], - 'Product id' - ) - ->addColumn( - 'entity_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Entity type id' - ) - ->addColumn( - 'reviews_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Qty of reviews' - ) - ->addColumn( - 'rating_summary', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Summarized rating' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store id' - ) - ->addIndex( - $installer->getIdxName('review_entity_summary', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('review_entity_summary', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Review aggregates'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'review_store' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('review_store')) - ->addColumn( - 'review_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Review Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store Id' - ) - ->addIndex( - $installer->getIdxName('review_store', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('review_store', 'review_id', 'review', 'review_id'), - 'review_id', - $installer->getTable('review'), - 'review_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('review_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Review Store'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_entity' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('rating_entity')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'entity_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => false], - 'Entity Code' - ) - ->addIndex( - $installer->getIdxName( - 'rating_entity', - ['entity_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->setComment('Rating entities'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('rating')) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rating Id' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Entity Id' - ) - ->addColumn( - 'rating_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => false], - 'Rating Code' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Rating Position On Frontend' - ) - ->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 1], - 'Rating is active.' - ) - ->addIndex( - $installer->getIdxName( - 'rating', - ['rating_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['rating_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('rating', ['entity_id']), - ['entity_id'] - ) - ->addForeignKey( - $installer->getFkName('rating', 'entity_id', 'rating_entity', 'entity_id'), - 'entity_id', - $installer->getTable('rating_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Ratings'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_option' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('rating_option')) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rating Option Id' - ) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Rating Id' - ) - ->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Rating Option Code' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Rating Option Value' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Ration option position on frontend' - ) - ->addIndex( - $installer->getIdxName('rating_option', ['rating_id']), - ['rating_id'] - ) - ->addForeignKey( - $installer->getFkName('rating_option', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Rating options'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_option_vote' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('rating_option_vote')) - ->addColumn( - 'vote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Vote id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Vote option id' - ) - ->addColumn( - 'remote_ip', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['nullable' => false], - 'Customer IP' - ) - ->addColumn( - 'remote_ip_long', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['nullable' => false, 'default' => 0], - 'Customer IP converted to long integer format' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => 0], - 'Customer Id' - ) - ->addColumn( - 'entity_pk_value', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Product id' - ) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Rating id' - ) - ->addColumn( - 'review_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true], - 'Review id' - ) - ->addColumn( - 'percent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0], - 'Percent amount' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0], - 'Vote option value' - ) - ->addIndex( - $installer->getIdxName('rating_option_vote', ['option_id']), - ['option_id'] - ) - ->addForeignKey( - $installer->getFkName('rating_option_vote', 'option_id', 'rating_option', 'option_id'), - 'option_id', - $installer->getTable('rating_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('rating_option_vote', 'review_id', 'review', 'review_id'), - 'review_id', - $installer->getTable('review'), - 'review_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Rating option values'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_option_vote_aggregated' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('rating_option_vote_aggregated')) - ->addColumn( - 'primary_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Vote aggregation id' - ) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Rating id' - ) - ->addColumn( - 'entity_pk_value', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Product id' - ) - ->addColumn( - 'vote_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Vote dty' - ) - ->addColumn( - 'vote_value_sum', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'General vote sum' - ) - ->addColumn( - 'percent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0], - 'Vote percent' - ) - ->addColumn( - 'percent_approved', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['default' => '0'], - 'Vote percent approved by admin' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Store Id' - ) - ->addIndex( - $installer->getIdxName('rating_option_vote_aggregated', ['rating_id']), - ['rating_id'] - ) - ->addIndex( - $installer->getIdxName('rating_option_vote_aggregated', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('rating_option_vote_aggregated', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('rating_option_vote_aggregated', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Rating vote aggregated'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_store' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('rating_store')) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], - 'Rating id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], - 'Store id' - ) - ->addIndex( - $installer->getIdxName('rating_store', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('rating_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('rating_store', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION - ) - ->setComment('Rating Store'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_title' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('rating_title')) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], - 'Rating Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], - 'Store Id' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Rating Label' - ) - ->addIndex( - $installer->getIdxName('rating_title', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('rating_title', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('rating_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Rating Title'); -$installer->getConnection()->createTable($table); - -$this->endSetup(); diff --git a/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php b/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php deleted file mode 100644 index ea355e2f962b6..0000000000000 --- a/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php +++ /dev/null @@ -1,5157 +0,0 @@ -startSetup(); - -/** - * Create table 'sales_order' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'State' -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Status' -)->addColumn( - 'coupon_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Coupon Code' -)->addColumn( - 'protect_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Protect Code' -)->addColumn( - 'shipping_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Description' -)->addColumn( - 'is_virtual', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Virtual' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer Id' -)->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Amount' -)->addColumn( - 'base_discount_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Canceled' -)->addColumn( - 'base_discount_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Invoiced' -)->addColumn( - 'base_discount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Refunded' -)->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' -)->addColumn( - 'base_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Amount' -)->addColumn( - 'base_shipping_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Canceled' -)->addColumn( - 'base_shipping_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Invoiced' -)->addColumn( - 'base_shipping_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Refunded' -)->addColumn( - 'base_shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Tax Amount' -)->addColumn( - 'base_shipping_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Tax Refunded' -)->addColumn( - 'base_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal' -)->addColumn( - 'base_subtotal_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Canceled' -)->addColumn( - 'base_subtotal_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Invoiced' -)->addColumn( - 'base_subtotal_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Refunded' -)->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Amount' -)->addColumn( - 'base_tax_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Canceled' -)->addColumn( - 'base_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Invoiced' -)->addColumn( - 'base_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Refunded' -)->addColumn( - 'base_to_global_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Global Rate' -)->addColumn( - 'base_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Order Rate' -)->addColumn( - 'base_total_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Canceled' -)->addColumn( - 'base_total_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Invoiced' -)->addColumn( - 'base_total_invoiced_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Invoiced Cost' -)->addColumn( - 'base_total_offline_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Offline Refunded' -)->addColumn( - 'base_total_online_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Online Refunded' -)->addColumn( - 'base_total_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Paid' -)->addColumn( - 'base_total_qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Qty Ordered' -)->addColumn( - 'base_total_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Refunded' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Amount' -)->addColumn( - 'discount_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Canceled' -)->addColumn( - 'discount_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Invoiced' -)->addColumn( - 'discount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Refunded' -)->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' -)->addColumn( - 'shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Amount' -)->addColumn( - 'shipping_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Canceled' -)->addColumn( - 'shipping_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Invoiced' -)->addColumn( - 'shipping_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Refunded' -)->addColumn( - 'shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Tax Amount' -)->addColumn( - 'shipping_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Tax Refunded' -)->addColumn( - 'store_to_base_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Base Rate' -)->addColumn( - 'store_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Order Rate' -)->addColumn( - 'subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal' -)->addColumn( - 'subtotal_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Canceled' -)->addColumn( - 'subtotal_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Invoiced' -)->addColumn( - 'subtotal_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Refunded' -)->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Amount' -)->addColumn( - 'tax_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Canceled' -)->addColumn( - 'tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Invoiced' -)->addColumn( - 'tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Refunded' -)->addColumn( - 'total_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Canceled' -)->addColumn( - 'total_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Invoiced' -)->addColumn( - 'total_offline_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Offline Refunded' -)->addColumn( - 'total_online_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Online Refunded' -)->addColumn( - 'total_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Paid' -)->addColumn( - 'total_qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Qty Ordered' -)->addColumn( - 'total_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Refunded' -)->addColumn( - 'can_ship_partially', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Can Ship Partially' -)->addColumn( - 'can_ship_partially_item', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Can Ship Partially Item' -)->addColumn( - 'customer_is_guest', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Customer Is Guest' -)->addColumn( - 'customer_note_notify', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Customer Note Notify' -)->addColumn( - 'billing_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Billing Address Id' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - [], - 'Customer Group Id' -)->addColumn( - 'edit_increment', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Edit Increment' -)->addColumn( - 'email_sent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Email Sent' -)->addColumn( - 'forced_shipment_with_invoice', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Forced Do Shipment With Invoice' -)->addColumn( - 'payment_auth_expiration', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Payment Authorization Expiration' -)->addColumn( - 'quote_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Quote Address Id' -)->addColumn( - 'quote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Quote Id' -)->addColumn( - 'shipping_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipping Address Id' -)->addColumn( - 'adjustment_negative', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Adjustment Negative' -)->addColumn( - 'adjustment_positive', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Adjustment Positive' -)->addColumn( - 'base_adjustment_negative', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Adjustment Negative' -)->addColumn( - 'base_adjustment_positive', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Adjustment Positive' -)->addColumn( - 'base_shipping_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Discount Amount' -)->addColumn( - 'base_subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Incl Tax' -)->addColumn( - 'base_total_due', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Due' -)->addColumn( - 'payment_authorization_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Payment Authorization Amount' -)->addColumn( - 'shipping_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Discount Amount' -)->addColumn( - 'subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Incl Tax' -)->addColumn( - 'total_due', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Due' -)->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Weight' -)->addColumn( - 'customer_dob', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Customer Dob' -)->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' -)->addColumn( - 'applied_rule_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Applied Rule Ids' -)->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' -)->addColumn( - 'customer_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Email' -)->addColumn( - 'customer_firstname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Firstname' -)->addColumn( - 'customer_lastname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Lastname' -)->addColumn( - 'customer_middlename', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Middlename' -)->addColumn( - 'customer_prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Prefix' -)->addColumn( - 'customer_suffix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Suffix' -)->addColumn( - 'customer_taxvat', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Taxvat' -)->addColumn( - 'discount_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Discount Description' -)->addColumn( - 'ext_customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Ext Customer Id' -)->addColumn( - 'ext_order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Ext Order Id' -)->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Global Currency Code' -)->addColumn( - 'hold_before_state', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Hold Before State' -)->addColumn( - 'hold_before_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Hold Before Status' -)->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Order Currency Code' -)->addColumn( - 'original_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Original Increment Id' -)->addColumn( - 'relation_child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Relation Child Id' -)->addColumn( - 'relation_child_real_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Relation Child Real Id' -)->addColumn( - 'relation_parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Relation Parent Id' -)->addColumn( - 'relation_parent_real_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Relation Parent Real Id' -)->addColumn( - 'remote_ip', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Remote Ip' -)->addColumn( - 'shipping_method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Method' -)->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Store Currency Code' -)->addColumn( - 'store_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Store Name' -)->addColumn( - 'x_forwarded_for', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'X Forwarded For' -)->addColumn( - 'customer_note', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Customer Note' -)->addColumn( - '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_UPDATE], - 'Updated At' -)->addColumn( - 'total_item_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Total Item Count' -)->addColumn( - 'customer_gender', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Customer Gender' -)->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' -)->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' -)->addColumn( - 'shipping_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Hidden Tax Amount' -)->addColumn( - 'base_shipping_hidden_tax_amnt', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Hidden Tax Amount' -)->addColumn( - 'hidden_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Invoiced' -)->addColumn( - 'base_hidden_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Invoiced' -)->addColumn( - 'hidden_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Refunded' -)->addColumn( - 'base_hidden_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Refunded' -)->addColumn( - 'shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Incl Tax' -)->addColumn( - 'base_shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Incl Tax' -)->addColumn( - 'coupon_rule_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Coupon Sales Rule Name' -)->addIndex( - $installer->getIdxName('sales_order', ['status']), - ['status'] -)->addIndex( - $installer->getIdxName('sales_order', ['state']), - ['state'] -)->addIndex( - $installer->getIdxName('sales_order', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName( - 'sales_order', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_order', ['created_at']), - ['created_at'] -)->addIndex( - $installer->getIdxName('sales_order', ['customer_id']), - ['customer_id'] -)->addIndex( - $installer->getIdxName('sales_order', ['ext_order_id']), - ['ext_order_id'] -)->addIndex( - $installer->getIdxName('sales_order', ['quote_id']), - ['quote_id'] -)->addIndex( - $installer->getIdxName('sales_order', ['updated_at']), - ['updated_at'] -)->addForeignKey( - $installer->getFkName('sales_order', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_order', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Order' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_order_grid' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_grid') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Status' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'store_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Store Name' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer Id' -)->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' -)->addColumn( - 'base_total_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Paid' -)->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' -)->addColumn( - 'total_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Paid' -)->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' -)->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' -)->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Order Currency Code' -)->addColumn( - 'shipping_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Name' -)->addColumn( - 'billing_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Billing Name' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' -)->addIndex( - $installer->getIdxName('sales_order_grid', ['status']), - ['status'] -)->addIndex( - $installer->getIdxName('sales_order_grid', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('sales_order_grid', ['base_grand_total']), - ['base_grand_total'] -)->addIndex( - $installer->getIdxName('sales_order_grid', ['base_total_paid']), - ['base_total_paid'] -)->addIndex( - $installer->getIdxName('sales_order_grid', ['grand_total']), - ['grand_total'] -)->addIndex( - $installer->getIdxName('sales_order_grid', ['total_paid']), - ['total_paid'] -)->addIndex( - $installer->getIdxName( - 'sales_order_grid', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_order_grid', ['shipping_name']), - ['shipping_name'] -)->addIndex( - $installer->getIdxName('sales_order_grid', ['billing_name']), - ['billing_name'] -)->addIndex( - $installer->getIdxName('sales_order_grid', ['created_at']), - ['created_at'] -)->addIndex( - $installer->getIdxName('sales_order_grid', ['customer_id']), - ['customer_id'] -)->addIndex( - $installer->getIdxName('sales_order_grid', ['updated_at']), - ['updated_at'] -)->addForeignKey( - $installer->getFkName('sales_order_grid', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_order_grid', 'entity_id', 'sales_order', 'entity_id'), - 'entity_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_order_grid', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Order Grid' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_order_address' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_address') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Id' -)->addColumn( - 'customer_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Customer Address Id' -)->addColumn( - 'quote_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Quote Address Id' -)->addColumn( - 'region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Region Id' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Customer Id' -)->addColumn( - 'fax', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Fax' -)->addColumn( - 'region', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Region' -)->addColumn( - 'postcode', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Postcode' -)->addColumn( - 'lastname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Lastname' -)->addColumn( - 'street', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Street' -)->addColumn( - 'city', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'City' -)->addColumn( - 'email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Email' -)->addColumn( - 'telephone', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Phone Number' -)->addColumn( - 'country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - [], - 'Country Id' -)->addColumn( - 'firstname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Firstname' -)->addColumn( - 'address_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Address Type' -)->addColumn( - 'prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Prefix' -)->addColumn( - 'middlename', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Middlename' -)->addColumn( - 'suffix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Suffix' -)->addColumn( - 'company', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Company' -)->addIndex( - $installer->getIdxName('sales_order_address', ['parent_id']), - ['parent_id'] -)->addForeignKey( - $installer->getFkName('sales_order_address', 'parent_id', 'sales_order', 'entity_id'), - 'parent_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Order Address' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_order_status_history' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_status_history') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' -)->addColumn( - 'is_customer_notified', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Is Customer Notified' -)->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible On Front' -)->addColumn( - 'comment', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Comment' -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Status' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addColumn( - 'entity_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true], - 'Shows what entity history is bind to.' -)->addIndex( - $installer->getIdxName('sales_order_status_history', ['parent_id']), - ['parent_id'] -)->addIndex( - $installer->getIdxName('sales_order_status_history', ['created_at']), - ['created_at'] -)->addForeignKey( - $installer->getFkName('sales_order_status_history', 'parent_id', 'sales_order', 'entity_id'), - 'parent_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Order Status History' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_order_item' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_item') -)->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Item Id' -)->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Order Id' -)->addColumn( - 'parent_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Item Id' -)->addColumn( - 'quote_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Quote Item Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Created At' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Updated At' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' -)->addColumn( - 'product_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Product Type' -)->addColumn( - 'product_options', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Product Options' -)->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Weight' -)->addColumn( - 'is_virtual', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Virtual' -)->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' -)->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' -)->addColumn( - 'applied_rule_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Applied Rule Ids' -)->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' -)->addColumn( - 'is_qty_decimal', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Qty Decimal' -)->addColumn( - 'no_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'No Discount' -)->addColumn( - 'qty_backordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Backordered' -)->addColumn( - 'qty_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Canceled' -)->addColumn( - 'qty_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Invoiced' -)->addColumn( - 'qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Ordered' -)->addColumn( - 'qty_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Refunded' -)->addColumn( - 'qty_shipped', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Shipped' -)->addColumn( - 'base_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Cost' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' -)->addColumn( - 'base_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Price' -)->addColumn( - 'original_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Original Price' -)->addColumn( - 'base_original_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Original Price' -)->addColumn( - 'tax_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Percent' -)->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Amount' -)->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Tax Amount' -)->addColumn( - 'tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Invoiced' -)->addColumn( - 'base_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Tax Invoiced' -)->addColumn( - 'discount_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Percent' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Amount' -)->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Discount Amount' -)->addColumn( - 'discount_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Invoiced' -)->addColumn( - 'base_discount_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Discount Invoiced' -)->addColumn( - 'amount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Amount Refunded' -)->addColumn( - 'base_amount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Amount Refunded' -)->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Row Total' -)->addColumn( - 'base_row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Row Total' -)->addColumn( - 'row_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Row Invoiced' -)->addColumn( - 'base_row_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Row Invoiced' -)->addColumn( - 'row_weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Row Weight' -)->addColumn( - 'base_tax_before_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Before Discount' -)->addColumn( - 'tax_before_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Before Discount' -)->addColumn( - 'ext_order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Ext Order Item Id' -)->addColumn( - 'locked_do_invoice', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Locked Do Invoice' -)->addColumn( - 'locked_do_ship', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Locked Do Ship' -)->addColumn( - 'price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price Incl Tax' -)->addColumn( - 'base_price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price Incl Tax' -)->addColumn( - 'row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total Incl Tax' -)->addColumn( - 'base_row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total Incl Tax' -)->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' -)->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' -)->addColumn( - 'hidden_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Invoiced' -)->addColumn( - 'base_hidden_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Invoiced' -)->addColumn( - 'hidden_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Refunded' -)->addColumn( - 'base_hidden_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Refunded' -)->addColumn( - 'tax_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Canceled' -)->addColumn( - 'hidden_tax_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Canceled' -)->addColumn( - 'tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Refunded' -)->addColumn( - 'base_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Refunded' -)->addColumn( - 'discount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Refunded' -)->addColumn( - 'base_discount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Refunded' -)->addIndex( - $installer->getIdxName('sales_order_item', ['order_id']), - ['order_id'] -)->addIndex( - $installer->getIdxName('sales_order_item', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('sales_order_item', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_order_item', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Order Item' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_order_payment' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_payment') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' -)->addColumn( - 'base_shipping_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Captured' -)->addColumn( - 'shipping_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Captured' -)->addColumn( - 'amount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount Refunded' -)->addColumn( - 'base_amount_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Paid' -)->addColumn( - 'amount_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount Canceled' -)->addColumn( - 'base_amount_authorized', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Authorized' -)->addColumn( - 'base_amount_paid_online', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Paid Online' -)->addColumn( - 'base_amount_refunded_online', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Refunded Online' -)->addColumn( - 'base_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Amount' -)->addColumn( - 'shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Amount' -)->addColumn( - 'amount_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount Paid' -)->addColumn( - 'amount_authorized', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount Authorized' -)->addColumn( - 'base_amount_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Ordered' -)->addColumn( - 'base_shipping_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Refunded' -)->addColumn( - 'shipping_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Refunded' -)->addColumn( - 'base_amount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Refunded' -)->addColumn( - 'amount_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount Ordered' -)->addColumn( - 'base_amount_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Canceled' -)->addColumn( - 'quote_payment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Quote Payment Id' -)->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' -)->addColumn( - 'cc_exp_month', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Exp Month' -)->addColumn( - 'cc_ss_start_year', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Ss Start Year' -)->addColumn( - 'echeck_bank_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Echeck Bank Name' -)->addColumn( - 'method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Method' -)->addColumn( - 'cc_debug_request_body', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Debug Request Body' -)->addColumn( - 'cc_secure_verify', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Secure Verify' -)->addColumn( - 'protection_eligibility', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Protection Eligibility' -)->addColumn( - 'cc_approval', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Approval' -)->addColumn( - 'cc_last_4', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Last 4' -)->addColumn( - 'cc_status_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Status Description' -)->addColumn( - 'echeck_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Echeck Type' -)->addColumn( - 'cc_debug_response_serialized', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Debug Response Serialized' -)->addColumn( - 'cc_ss_start_month', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Ss Start Month' -)->addColumn( - 'echeck_account_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Echeck Account Type' -)->addColumn( - 'last_trans_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Last Trans Id' -)->addColumn( - 'cc_cid_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Cid Status' -)->addColumn( - 'cc_owner', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Owner' -)->addColumn( - 'cc_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Type' -)->addColumn( - 'po_number', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Po Number' -)->addColumn( - 'cc_exp_year', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Cc Exp Year' -)->addColumn( - 'cc_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Status' -)->addColumn( - 'echeck_routing_number', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Echeck Routing Number' -)->addColumn( - 'account_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Account Status' -)->addColumn( - 'anet_trans_method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Anet Trans Method' -)->addColumn( - 'cc_debug_response_body', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Debug Response Body' -)->addColumn( - 'cc_ss_issue', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Ss Issue' -)->addColumn( - 'echeck_account_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Echeck Account Name' -)->addColumn( - 'cc_avs_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Avs Status' -)->addColumn( - 'cc_number_enc', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Number Enc' -)->addColumn( - 'cc_trans_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Trans Id' -)->addColumn( - 'address_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Address Status' -)->addColumn( - 'additional_information', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Information' -)->addIndex( - $installer->getIdxName('sales_order_payment', ['parent_id']), - ['parent_id'] -)->addForeignKey( - $installer->getFkName('sales_order_payment', 'parent_id', 'sales_order', 'entity_id'), - 'parent_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Order Payment' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_shipment' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipment') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'total_weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Weight' -)->addColumn( - 'total_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Qty' -)->addColumn( - 'email_sent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Email Sent' -)->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Customer Id' -)->addColumn( - 'shipping_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipping Address Id' -)->addColumn( - 'billing_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Billing Address Id' -)->addColumn( - 'shipment_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipment Status' -)->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' -)->addColumn( - 'packages', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '20000', - [], - 'Packed Products in Packages' -)->addColumn( - 'shipping_label', - \Magento\Framework\DB\Ddl\Table::TYPE_VARBINARY, - '2m', - [], - 'Shipping Label Content' -)->addIndex( - $installer->getIdxName('sales_shipment', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('sales_shipment', ['total_qty']), - ['total_qty'] -)->addIndex( - $installer->getIdxName( - 'sales_shipment', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_shipment', ['order_id']), - ['order_id'] -)->addIndex( - $installer->getIdxName('sales_shipment', ['created_at']), - ['created_at'] -)->addIndex( - $installer->getIdxName('sales_shipment', ['updated_at']), - ['updated_at'] -)->addForeignKey( - $installer->getFkName('sales_shipment', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_shipment', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Shipment' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_shipment_grid' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipment_grid') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'total_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Qty' -)->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' -)->addColumn( - 'shipment_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipment Status' -)->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' -)->addColumn( - 'order_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Increment Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addColumn( - 'order_created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Order Created At' -)->addColumn( - 'shipping_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Name' -)->addIndex( - $installer->getIdxName('sales_shipment_grid', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('sales_shipment_grid', ['total_qty']), - ['total_qty'] -)->addIndex( - $installer->getIdxName('sales_shipment_grid', ['order_id']), - ['order_id'] -)->addIndex( - $installer->getIdxName('sales_shipment_grid', ['shipment_status']), - ['shipment_status'] -)->addIndex( - $installer->getIdxName( - 'sales_shipment_grid', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_shipment_grid', ['order_increment_id']), - ['order_increment_id'] -)->addIndex( - $installer->getIdxName('sales_shipment_grid', ['created_at']), - ['created_at'] -)->addIndex( - $installer->getIdxName('sales_shipment_grid', ['order_created_at']), - ['order_created_at'] -)->addIndex( - $installer->getIdxName('sales_shipment_grid', ['shipping_name']), - ['shipping_name'] -)->addForeignKey( - $installer->getFkName('sales_shipment_grid', 'entity_id', 'sales_shipment', 'entity_id'), - 'entity_id', - $installer->getTable('sales_shipment'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_shipment_grid', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Shipment Grid' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_shipment_item' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipment_item') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' -)->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' -)->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Weight' -)->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Qty' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Product Id' -)->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Order Item Id' -)->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' -)->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' -)->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' -)->addIndex( - $installer->getIdxName('sales_shipment_item', ['parent_id']), - ['parent_id'] -)->addForeignKey( - $installer->getFkName('sales_shipment_item', 'parent_id', 'sales_shipment', 'entity_id'), - 'parent_id', - $installer->getTable('sales_shipment'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Shipment Item' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_shipment_track' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipment_track') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' -)->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Weight' -)->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Qty' -)->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' -)->addColumn( - 'track_number', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Number' -)->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' -)->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Title' -)->addColumn( - 'carrier_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Carrier Code' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' -)->addIndex( - $installer->getIdxName('sales_shipment_track', ['parent_id']), - ['parent_id'] -)->addIndex( - $installer->getIdxName('sales_shipment_track', ['order_id']), - ['order_id'] -)->addIndex( - $installer->getIdxName('sales_shipment_track', ['created_at']), - ['created_at'] -)->addForeignKey( - $installer->getFkName('sales_shipment_track', 'parent_id', 'sales_shipment', 'entity_id'), - 'parent_id', - $installer->getTable('sales_shipment'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Shipment Track' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_shipment_comment' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipment_comment') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' -)->addColumn( - 'is_customer_notified', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Is Customer Notified' -)->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible On Front' -)->addColumn( - 'comment', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Comment' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addIndex( - $installer->getIdxName('sales_shipment_comment', ['created_at']), - ['created_at'] -)->addIndex( - $installer->getIdxName('sales_shipment_comment', ['parent_id']), - ['parent_id'] -)->addForeignKey( - $installer->getFkName('sales_shipment_comment', 'parent_id', 'sales_shipment', 'entity_id'), - 'parent_id', - $installer->getTable('sales_shipment'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Shipment Comment' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_invoice' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoice') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'identity' => true], - 'Entity Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' -)->addColumn( - 'shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Tax Amount' -)->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Amount' -)->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Amount' -)->addColumn( - 'store_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Order Rate' -)->addColumn( - 'base_shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Tax Amount' -)->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Amount' -)->addColumn( - 'base_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Order Rate' -)->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' -)->addColumn( - 'shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Amount' -)->addColumn( - 'subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Incl Tax' -)->addColumn( - 'base_subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Incl Tax' -)->addColumn( - 'store_to_base_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Base Rate' -)->addColumn( - 'base_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Amount' -)->addColumn( - 'total_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Qty' -)->addColumn( - 'base_to_global_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Global Rate' -)->addColumn( - 'subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal' -)->addColumn( - 'base_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Amount' -)->addColumn( - 'billing_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Billing Address Id' -)->addColumn( - 'is_used_for_refund', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Used For Refund' -)->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' -)->addColumn( - 'email_sent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Email Sent' -)->addColumn( - 'can_void_flag', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Can Void Flag' -)->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'State' -)->addColumn( - 'shipping_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipping Address Id' -)->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Store Currency Code' -)->addColumn( - 'transaction_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Transaction Id' -)->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Order Currency Code' -)->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' -)->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Global Currency Code' -)->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' -)->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' -)->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' -)->addColumn( - 'shipping_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Hidden Tax Amount' -)->addColumn( - 'base_shipping_hidden_tax_amnt', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Hidden Tax Amount' -)->addColumn( - 'shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Incl Tax' -)->addColumn( - 'base_shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Incl Tax' -)->addColumn( - 'base_total_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Refunded' -)->addColumn( - 'discount_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Discount Description' -)->addIndex( - $installer->getIdxName('sales_invoice', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('sales_invoice', ['grand_total']), - ['grand_total'] -)->addIndex( - $installer->getIdxName('sales_invoice', ['order_id']), - ['order_id'] -)->addIndex( - $installer->getIdxName('sales_invoice', ['state']), - ['state'] -)->addIndex( - $installer->getIdxName( - 'sales_invoice', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_invoice', ['created_at']), - ['created_at'] -)->addForeignKey( - $installer->getFkName('sales_invoice', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_invoice', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Invoice' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_invoice_grid' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoice_grid') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' -)->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' -)->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' -)->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'State' -)->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Store Currency Code' -)->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Order Currency Code' -)->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' -)->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Global Currency Code' -)->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' -)->addColumn( - 'order_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Increment Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addColumn( - 'order_created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Order Created At' -)->addColumn( - 'billing_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Billing Name' -)->addIndex( - $installer->getIdxName('sales_invoice_grid', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('sales_invoice_grid', ['grand_total']), - ['grand_total'] -)->addIndex( - $installer->getIdxName('sales_invoice_grid', ['order_id']), - ['order_id'] -)->addIndex( - $installer->getIdxName('sales_invoice_grid', ['state']), - ['state'] -)->addIndex( - $installer->getIdxName( - 'sales_invoice_grid', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_invoice_grid', ['order_increment_id']), - ['order_increment_id'] -)->addIndex( - $installer->getIdxName('sales_invoice_grid', ['created_at']), - ['created_at'] -)->addIndex( - $installer->getIdxName('sales_invoice_grid', ['order_created_at']), - ['order_created_at'] -)->addIndex( - $installer->getIdxName('sales_invoice_grid', ['billing_name']), - ['billing_name'] -)->addForeignKey( - $installer->getFkName('sales_invoice_grid', 'entity_id', 'sales_invoice', 'entity_id'), - 'entity_id', - $installer->getTable('sales_invoice'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_invoice_grid', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Invoice Grid' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_invoice_item' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoice_item') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' -)->addColumn( - 'base_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price' -)->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Amount' -)->addColumn( - 'base_row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Amount' -)->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total' -)->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Amount' -)->addColumn( - 'price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price Incl Tax' -)->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Amount' -)->addColumn( - 'base_price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price Incl Tax' -)->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Qty' -)->addColumn( - 'base_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Cost' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' -)->addColumn( - 'base_row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total Incl Tax' -)->addColumn( - 'row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total Incl Tax' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Product Id' -)->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Order Item Id' -)->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' -)->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' -)->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' -)->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' -)->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' -)->addColumn( - 'tax_ratio', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 512, - [], - 'Ratio of tax invoiced over tax of the order item' -)->addIndex( - $installer->getIdxName('sales_invoice_item', ['parent_id']), - ['parent_id'] -)->addForeignKey( - $installer->getFkName('sales_invoice_item', 'parent_id', 'sales_invoice', 'entity_id'), - 'parent_id', - $installer->getTable('sales_invoice'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Invoice Item' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_invoice_comment' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoice_comment') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' -)->addColumn( - 'is_customer_notified', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Customer Notified' -)->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible On Front' -)->addColumn( - 'comment', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Comment' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addIndex( - $installer->getIdxName('sales_invoice_comment', ['created_at']), - ['created_at'] -)->addIndex( - $installer->getIdxName('sales_invoice_comment', ['parent_id']), - ['parent_id'] -)->addForeignKey( - $installer->getFkName('sales_invoice_comment', 'parent_id', 'sales_invoice', 'entity_id'), - 'parent_id', - $installer->getTable('sales_invoice'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Invoice Comment' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_creditmemo' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_creditmemo') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'adjustment_positive', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Adjustment Positive' -)->addColumn( - 'base_shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Tax Amount' -)->addColumn( - 'store_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Order Rate' -)->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Amount' -)->addColumn( - 'base_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Order Rate' -)->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' -)->addColumn( - 'base_adjustment_negative', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Adjustment Negative' -)->addColumn( - 'base_subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Incl Tax' -)->addColumn( - 'shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Amount' -)->addColumn( - 'subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Incl Tax' -)->addColumn( - 'adjustment_negative', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Adjustment Negative' -)->addColumn( - 'base_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Amount' -)->addColumn( - 'store_to_base_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Base Rate' -)->addColumn( - 'base_to_global_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Global Rate' -)->addColumn( - 'base_adjustment', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Adjustment' -)->addColumn( - 'base_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Amount' -)->addColumn( - 'subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal' -)->addColumn( - 'adjustment', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Adjustment' -)->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' -)->addColumn( - 'base_adjustment_positive', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Adjustment Positive' -)->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Amount' -)->addColumn( - 'shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Tax Amount' -)->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Amount' -)->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' -)->addColumn( - 'email_sent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Email Sent' -)->addColumn( - 'creditmemo_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Creditmemo Status' -)->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'State' -)->addColumn( - 'shipping_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipping Address Id' -)->addColumn( - 'billing_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Billing Address Id' -)->addColumn( - 'invoice_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Invoice Id' -)->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Store Currency Code' -)->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Order Currency Code' -)->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' -)->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Global Currency Code' -)->addColumn( - 'transaction_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Transaction Id' -)->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' -)->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' -)->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' -)->addColumn( - 'shipping_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Hidden Tax Amount' -)->addColumn( - 'base_shipping_hidden_tax_amnt', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Hidden Tax Amount' -)->addColumn( - 'shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Incl Tax' -)->addColumn( - 'base_shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Incl Tax' -)->addColumn( - 'discount_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Discount Description' -)->addIndex( - $installer->getIdxName('sales_creditmemo', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('sales_creditmemo', ['order_id']), - ['order_id'] -)->addIndex( - $installer->getIdxName('sales_creditmemo', ['creditmemo_status']), - ['creditmemo_status'] -)->addIndex( - $installer->getIdxName( - 'sales_creditmemo', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_creditmemo', ['state']), - ['state'] -)->addIndex( - $installer->getIdxName('sales_creditmemo', ['created_at']), - ['created_at'] -)->addForeignKey( - $installer->getFkName('sales_creditmemo', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_creditmemo', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Creditmemo' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_creditmemo_grid' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_creditmemo_grid') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'store_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Order Rate' -)->addColumn( - 'base_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Order Rate' -)->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' -)->addColumn( - 'store_to_base_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Base Rate' -)->addColumn( - 'base_to_global_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Global Rate' -)->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' -)->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' -)->addColumn( - 'creditmemo_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Creditmemo Status' -)->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'State' -)->addColumn( - 'invoice_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Invoice Id' -)->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Store Currency Code' -)->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Order Currency Code' -)->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' -)->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Global Currency Code' -)->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' -)->addColumn( - 'order_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Increment Id' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addColumn( - 'order_created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Order Created At' -)->addColumn( - 'billing_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Billing Name' -)->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['grand_total']), - ['grand_total'] -)->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['base_grand_total']), - ['base_grand_total'] -)->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['order_id']), - ['order_id'] -)->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['creditmemo_status']), - ['creditmemo_status'] -)->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['state']), - ['state'] -)->addIndex( - $installer->getIdxName( - 'sales_creditmemo_grid', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['order_increment_id']), - ['order_increment_id'] -)->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['created_at']), - ['created_at'] -)->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['order_created_at']), - ['order_created_at'] -)->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['billing_name']), - ['billing_name'] -)->addForeignKey( - $installer->getFkName('sales_creditmemo_grid', 'entity_id', 'sales_creditmemo', 'entity_id'), - 'entity_id', - $installer->getTable('sales_creditmemo'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_creditmemo_grid', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Creditmemo Grid' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_creditmemo_item' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_creditmemo_item') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' -)->addColumn( - 'base_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price' -)->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Amount' -)->addColumn( - 'base_row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Amount' -)->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total' -)->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Amount' -)->addColumn( - 'price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price Incl Tax' -)->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Amount' -)->addColumn( - 'base_price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price Incl Tax' -)->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Qty' -)->addColumn( - 'base_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Cost' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' -)->addColumn( - 'base_row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total Incl Tax' -)->addColumn( - 'row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total Incl Tax' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Product Id' -)->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Order Item Id' -)->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' -)->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' -)->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' -)->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' -)->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' -)->addColumn( - 'tax_ratio', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 512, - [], - 'Ratio of tax in the creditmemo item over tax of the order item' -)->addIndex( - $installer->getIdxName('sales_creditmemo_item', ['parent_id']), - ['parent_id'] -)->addForeignKey( - $installer->getFkName('sales_creditmemo_item', 'parent_id', 'sales_creditmemo', 'entity_id'), - 'parent_id', - $installer->getTable('sales_creditmemo'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Creditmemo Item' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_creditmemo_comment' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_creditmemo_comment') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' -)->addColumn( - 'is_customer_notified', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Is Customer Notified' -)->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible On Front' -)->addColumn( - 'comment', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Comment' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addIndex( - $installer->getIdxName('sales_creditmemo_comment', ['created_at']), - ['created_at'] -)->addIndex( - $installer->getIdxName('sales_creditmemo_comment', ['parent_id']), - ['parent_id'] -)->addForeignKey( - $installer->getFkName('sales_creditmemo_comment', 'parent_id', 'sales_creditmemo', 'entity_id'), - 'parent_id', - $installer->getTable('sales_creditmemo'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Flat Creditmemo Comment' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_invoiced_aggregated' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoiced_aggregated') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' -)->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' -)->addColumn( - 'orders_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Orders Invoiced' -)->addColumn( - 'invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced' -)->addColumn( - 'invoiced_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced Captured' -)->addColumn( - 'invoiced_not_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced Not Captured' -)->addIndex( - $installer->getIdxName( - 'sales_invoiced_aggregated', - ['period', 'store_id', 'order_status'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_invoiced_aggregated', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Invoiced Aggregated' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_invoiced_aggregated_order' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoiced_aggregated_order') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false, 'default' => false], - 'Order Status' -)->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' -)->addColumn( - 'orders_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Orders Invoiced' -)->addColumn( - 'invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced' -)->addColumn( - 'invoiced_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced Captured' -)->addColumn( - 'invoiced_not_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced Not Captured' -)->addIndex( - $installer->getIdxName( - 'sales_invoiced_aggregated_order', - ['period', 'store_id', 'order_status'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_invoiced_aggregated_order', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Invoiced Aggregated Order' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_order_aggregated_created' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_aggregated_created') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false, 'default' => false], - 'Order Status' -)->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' -)->addColumn( - 'total_qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Qty Ordered' -)->addColumn( - 'total_qty_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Qty Invoiced' -)->addColumn( - 'total_income_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Income Amount' -)->addColumn( - 'total_revenue_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Revenue Amount' -)->addColumn( - 'total_profit_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Profit Amount' -)->addColumn( - 'total_invoiced_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Invoiced Amount' -)->addColumn( - 'total_canceled_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Canceled Amount' -)->addColumn( - 'total_paid_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Paid Amount' -)->addColumn( - 'total_refunded_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Refunded Amount' -)->addColumn( - 'total_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Tax Amount' -)->addColumn( - 'total_tax_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Tax Amount Actual' -)->addColumn( - 'total_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Shipping Amount' -)->addColumn( - 'total_shipping_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Shipping Amount Actual' -)->addColumn( - 'total_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Discount Amount' -)->addColumn( - 'total_discount_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Discount Amount Actual' -)->addIndex( - $installer->getIdxName( - 'sales_order_aggregated_created', - ['period', 'store_id', 'order_status'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_order_aggregated_created', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Order Aggregated Created' -); -$installer->getConnection()->createTable($table); - -$installer->getConnection()->createTable( - $installer->getConnection()->createTableByDdl( - $installer->getTable('sales_order_aggregated_created'), - $installer->getTable('sales_order_aggregated_updated') - ) -); - -/** - * Create table 'sales_payment_transaction' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_payment_transaction') -)->addColumn( - 'transaction_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Transaction Id' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Id' -)->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Order Id' -)->addColumn( - 'payment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Payment Id' -)->addColumn( - 'txn_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - [], - 'Txn Id' -)->addColumn( - 'parent_txn_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - [], - 'Parent Txn Id' -)->addColumn( - 'txn_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 15, - [], - 'Txn Type' -)->addColumn( - 'is_closed', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Closed' -)->addColumn( - 'additional_information', - \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, - '64K', - [], - 'Additional Information' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' -)->addIndex( - $installer->getIdxName( - 'sales_payment_transaction', - ['order_id', 'payment_id', 'txn_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['order_id', 'payment_id', 'txn_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_payment_transaction', ['parent_id']), - ['parent_id'] -)->addIndex( - $installer->getIdxName('sales_payment_transaction', ['payment_id']), - ['payment_id'] -)->addForeignKey( - $installer->getFkName('sales_payment_transaction', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_payment_transaction', 'parent_id', 'sales_payment_transaction', 'transaction_id'), - 'parent_id', - $installer->getTable('sales_payment_transaction'), - 'transaction_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_payment_transaction', 'payment_id', 'sales_order_payment', 'entity_id'), - 'payment_id', - $installer->getTable('sales_order_payment'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Payment Transaction' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_refunded_aggregated' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_refunded_aggregated') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false, 'default' => false], - 'Order Status' -)->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' -)->addColumn( - 'refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Refunded' -)->addColumn( - 'online_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Online Refunded' -)->addColumn( - 'offline_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Offline Refunded' -)->addIndex( - $installer->getIdxName( - 'sales_refunded_aggregated', - ['period', 'store_id', 'order_status'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_refunded_aggregated', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Refunded Aggregated' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_refunded_aggregated_order' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_refunded_aggregated_order') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' -)->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' -)->addColumn( - 'refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Refunded' -)->addColumn( - 'online_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Online Refunded' -)->addColumn( - 'offline_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Offline Refunded' -)->addIndex( - $installer->getIdxName( - 'sales_refunded_aggregated_order', - ['period', 'store_id', 'order_status'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_refunded_aggregated_order', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Refunded Aggregated Order' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_shipping_aggregated' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipping_aggregated') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' -)->addColumn( - 'shipping_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Description' -)->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' -)->addColumn( - 'total_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Shipping' -)->addColumn( - 'total_shipping_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Shipping Actual' -)->addIndex( - $installer->getIdxName( - 'sales_shipping_aggregated', - ['period', 'store_id', 'order_status', 'shipping_description'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status', 'shipping_description'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_shipping_aggregated', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Shipping Aggregated' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_shipping_aggregated_order' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipping_aggregated_order') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' -)->addColumn( - 'shipping_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Description' -)->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' -)->addColumn( - 'total_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Shipping' -)->addColumn( - 'total_shipping_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Shipping Actual' -)->addIndex( - $installer->getIdxName( - 'sales_shipping_aggregated_order', - ['period', 'store_id', 'order_status', 'shipping_description'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status', 'shipping_description'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_shipping_aggregated_order', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Shipping Aggregated Order' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_bestsellers_aggregated_daily' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_bestsellers_aggregated_daily') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' -)->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' -)->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' -)->addColumn( - 'qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty Ordered' -)->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' -)->addIndex( - $installer->getIdxName( - 'sales_bestsellers_aggregated_daily', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_daily', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_daily', ['product_id']), - ['product_id'] -)->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_daily', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Bestsellers Aggregated Daily' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_bestsellers_aggregated_monthly' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_bestsellers_aggregated_monthly') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' -)->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' -)->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' -)->addColumn( - 'qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty Ordered' -)->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' -)->addIndex( - $installer->getIdxName( - 'sales_bestsellers_aggregated_monthly', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_monthly', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_monthly', ['product_id']), - ['product_id'] -)->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_monthly', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Bestsellers Aggregated Monthly' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_bestsellers_aggregated_yearly' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_bestsellers_aggregated_yearly') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' -)->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' -)->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' -)->addColumn( - 'qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty Ordered' -)->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' -)->addIndex( - $installer->getIdxName( - 'sales_bestsellers_aggregated_yearly', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_yearly', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_yearly', ['product_id']), - ['product_id'] -)->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_yearly', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Bestsellers Aggregated Yearly' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_order_tax' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_tax') -)->addColumn( - 'tax_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Tax Id' -)->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Code' -)->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Title' -)->addColumn( - 'percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Percent' -)->addColumn( - 'amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount' -)->addColumn( - 'priority', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Priority' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Position' -)->addColumn( - 'base_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount' -)->addColumn( - 'process', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false], - 'Process' -)->addColumn( - 'base_real_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Real Amount' -)->addColumn( - 'hidden', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Hidden' -)->addIndex( - $installer->getIdxName('sales_order_tax', ['order_id', 'priority', 'position']), - ['order_id', 'priority', 'position'] -)->setComment( - 'Sales Order Tax Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_order_status' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_status') -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Status' -)->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 128, - ['nullable' => false], - 'Label' -)->setComment( - 'Sales Order Status Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_order_status_state' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_status_state') -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Status' -)->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Label' -)->addColumn( - 'is_default', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Default' -)->addColumn( - 'visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 1, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Visible on front' -)->addForeignKey( - $installer->getFkName('sales_order_status_state', 'status', 'sales_order_status', 'status'), - 'status', - $installer->getTable('sales_order_status'), - 'status', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Order Status Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'sales_order_status_label' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_status_label') -)->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Status' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store Id' -)->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 128, - ['nullable' => false], - 'Label' -)->addIndex( - $installer->getIdxName('sales_order_status_label', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('sales_order_status_label', 'status', 'sales_order_status', 'status'), - 'status', - $installer->getTable('sales_order_status'), - 'status', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Order Status Label Table' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-2.0.0-2.0.1.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-2.0.0-2.0.1.php deleted file mode 100644 index 13cdad22d5bab..0000000000000 --- a/app/code/Magento/Sales/sql/sales_setup/upgrade-2.0.0-2.0.1.php +++ /dev/null @@ -1,45 +0,0 @@ -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); - } -} diff --git a/app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php b/app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php deleted file mode 100644 index 4c4c9fb099778..0000000000000 --- a/app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php +++ /dev/null @@ -1,28 +0,0 @@ -createMigrationSetup(); -$installer->startSetup(); - -$installer->appendClassAliasReplace( - 'salesrule', - 'conditions_serialized', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, - ['rule_id'] -); -$installer->appendClassAliasReplace( - 'salesrule', - 'actions_serialized', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, - ['rule_id'] -); - -$installer->doUpdateClassAliases(); - -$installer->endSetup(); diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php b/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php deleted file mode 100644 index eb7d8f0157b37..0000000000000 --- a/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php +++ /dev/null @@ -1,781 +0,0 @@ -startSetup(); - -/** - * Create table 'salesrule' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('salesrule') -)->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' -)->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' -)->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' -)->addColumn( - 'from_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => true, 'default' => null], - 'From Date' -)->addColumn( - 'to_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => true, 'default' => null], - 'To Date' -)->addColumn( - 'uses_per_customer', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Uses Per Customer' -)->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Is Active' -)->addColumn( - 'conditions_serialized', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Conditions Serialized' -)->addColumn( - 'actions_serialized', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Actions Serialized' -)->addColumn( - 'stop_rules_processing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Stop Rules Processing' -)->addColumn( - 'is_advanced', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Advanced' -)->addColumn( - 'product_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Product Ids' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' -)->addColumn( - 'simple_action', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Simple Action' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount' -)->addColumn( - 'discount_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - [], - 'Discount Qty' -)->addColumn( - 'discount_step', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Discount Step' -)->addColumn( - 'apply_to_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Apply To Shipping' -)->addColumn( - 'times_used', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Times Used' -)->addColumn( - 'is_rss', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Is Rss' -)->addColumn( - 'coupon_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Coupon Type' -)->addColumn( - 'use_auto_generation', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => false, 'nullable' => false, 'default' => 0], - 'Use Auto Generation' -)->addColumn( - 'uses_per_coupon', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => 0], - 'User Per Coupon' -)->addIndex( - $installer->getIdxName('salesrule', ['is_active', 'sort_order', 'to_date', 'from_date']), - ['is_active', 'sort_order', 'to_date', 'from_date'] -)->setComment( - 'Salesrule' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'salesrule_coupon' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_coupon') -)->addColumn( - 'coupon_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Coupon Id' -)->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Rule Id' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Code' -)->addColumn( - 'usage_limit', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Usage Limit' -)->addColumn( - 'usage_per_customer', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Usage Per Customer' -)->addColumn( - 'times_used', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Times Used' -)->addColumn( - 'expiration_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Expiration Date' -)->addColumn( - 'is_primary', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Primary' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Coupon Code Creation Date' -)->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => true, 'default' => 0], - 'Coupon Code Type' -)->addIndex( - $installer->getIdxName( - 'salesrule_coupon', - ['code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName( - 'salesrule_coupon', - ['rule_id', 'is_primary'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['rule_id', 'is_primary'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('salesrule_coupon', ['rule_id']), - ['rule_id'] -)->addForeignKey( - $installer->getFkName('salesrule_coupon', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Salesrule Coupon' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'salesrule_coupon_usage' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_coupon_usage') -)->addColumn( - 'coupon_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Coupon Id' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Id' -)->addColumn( - 'times_used', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Times Used' -)->addIndex( - $installer->getIdxName('salesrule_coupon_usage', ['customer_id']), - ['customer_id'] -)->addForeignKey( - $installer->getFkName('salesrule_coupon_usage', 'coupon_id', 'salesrule_coupon', 'coupon_id'), - 'coupon_id', - $installer->getTable('salesrule_coupon'), - 'coupon_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Salesrule Coupon Usage' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'salesrule_customer' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_customer') -)->addColumn( - 'rule_customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Customer Id' -)->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rule Id' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Id' -)->addColumn( - 'times_used', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Times Used' -)->addIndex( - $installer->getIdxName('salesrule_customer', ['rule_id', 'customer_id']), - ['rule_id', 'customer_id'] -)->addIndex( - $installer->getIdxName('salesrule_customer', ['customer_id', 'rule_id']), - ['customer_id', 'rule_id'] -)->addForeignKey( - $installer->getFkName('salesrule_customer', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Salesrule Customer' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'salesrule_label' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_label') -)->addColumn( - 'label_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Label Id' -)->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Rule Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' -)->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Label' -)->addIndex( - $installer->getIdxName( - 'salesrule_label', - ['rule_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['rule_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('salesrule_label', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('salesrule_label', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('salesrule_label', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Salesrule Label' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'salesrule_product_attribute' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_product_attribute') -)->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Id' -)->addIndex( - $installer->getIdxName('salesrule_product_attribute', ['website_id']), - ['website_id'] -)->addIndex( - $installer->getIdxName('salesrule_product_attribute', ['customer_group_id']), - ['customer_group_id'] -)->addIndex( - $installer->getIdxName('salesrule_product_attribute', ['attribute_id']), - ['attribute_id'] -)->addForeignKey( - $installer->getFkName('salesrule_product_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION -)->addForeignKey( - $installer->getFkName('salesrule_product_attribute', 'customer_group_id', 'customer_group', 'customer_group_id'), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION -)->addForeignKey( - $installer->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION -)->addForeignKey( - $installer->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION -)->setComment( - 'Salesrule Product Attribute' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'salesrule_coupon_aggregated' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_coupon_aggregated') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => false], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' -)->addColumn( - 'coupon_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Coupon Code' -)->addColumn( - 'coupon_uses', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Coupon Uses' -)->addColumn( - 'subtotal_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Subtotal Amount' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount' -)->addColumn( - 'total_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Total Amount' -)->addColumn( - 'subtotal_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Subtotal Amount Actual' -)->addColumn( - 'discount_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount Actual' -)->addColumn( - 'total_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Total Amount Actual' -)->addColumn( - 'rule_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Rule Name' -)->addIndex( - $installer->getIdxName( - 'salesrule_coupon_aggregated', - ['period', 'store_id', 'order_status', 'coupon_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status', 'coupon_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('salesrule_coupon_aggregated', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('salesrule_coupon_aggregated', ['rule_name']), - ['rule_name'] -)->addForeignKey( - $installer->getFkName('salesrule_coupon_aggregated', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Coupon Aggregated' -); -$installer->getConnection()->createTable($table); - -$installer->getConnection()->createTable( - $installer->getConnection()->createTableByDdl( - $installer->getTable('salesrule_coupon_aggregated'), - $installer->getTable('salesrule_coupon_aggregated_updated') - ) -); - -/** - * Create table 'salesrule_coupon_aggregated_order' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_coupon_aggregated_order') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => false], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' -)->addColumn( - 'coupon_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Coupon Code' -)->addColumn( - 'coupon_uses', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Coupon Uses' -)->addColumn( - 'subtotal_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Subtotal Amount' -)->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount' -)->addColumn( - 'total_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Total Amount' -)->addColumn( - 'rule_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Rule Name' -)->addIndex( - $installer->getIdxName( - 'salesrule_coupon_aggregated_order', - ['period', 'store_id', 'order_status', 'coupon_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status', 'coupon_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('salesrule_coupon_aggregated_order', ['store_id']), - ['store_id'] -)->addIndex( - $installer->getIdxName('salesrule_coupon_aggregated_order', ['rule_name']), - ['rule_name'] -)->addForeignKey( - $installer->getFkName('salesrule_coupon_aggregated_order', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Coupon Aggregated Order' -); -$installer->getConnection()->createTable($table); - -$websitesTable = $installer->getTable('store_website'); -$customerGroupsTable = $installer->getTable('customer_group'); -$rulesWebsitesTable = $installer->getTable('salesrule_website'); -$rulesCustomerGroupsTable = $installer->getTable('salesrule_customer_group'); - -/** - * Create table 'salesrule_website' if not exists. This table will be used instead of - * column website_ids of main catalog rules table - */ -$table = $installer->getConnection()->newTable( - $rulesWebsitesTable -)->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' -)->addIndex( - $installer->getIdxName('salesrule_website', ['website_id']), - ['website_id'] -)->addForeignKey( - $installer->getFkName('salesrule_website', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'), - 'website_id', - $websitesTable, - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Rules To Websites Relations' -); - -$installer->getConnection()->createTable($table); - -/** - * Create table 'salesrule_customer_group' if not exists. This table will be used instead of - * column customer_group_ids of main catalog rules table - */ -$table = $installer->getConnection()->newTable( - $rulesCustomerGroupsTable -)->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' -)->addIndex( - $installer->getIdxName('salesrule_customer_group', ['customer_group_id']), - ['customer_group_id'] -)->addForeignKey( - $installer->getFkName('salesrule_customer_group', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('salesrule_customer_group', 'customer_group_id', 'customer_group', 'customer_group_id'), - 'customer_group_id', - $customerGroupsTable, - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Rules To Customer Groups Relations' -); - -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Search/sql/search_setup/install-2.0.0.php b/app/code/Magento/Search/sql/search_setup/install-2.0.0.php deleted file mode 100644 index c5f0cd16a71ad..0000000000000 --- a/app/code/Magento/Search/sql/search_setup/install-2.0.0.php +++ /dev/null @@ -1,117 +0,0 @@ -startSetup(); - -/** - * Create table 'search_query' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('search_query')) - ->addColumn( - 'query_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Query ID' - ) - ->addColumn( - 'query_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Query text' - ) - ->addColumn( - 'num_results', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Num results' - ) - ->addColumn( - 'popularity', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Popularity' - ) - ->addColumn( - 'redirect', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Redirect' - ) - ->addColumn( - 'synonym_for', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Synonym for' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'display_in_terms', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Display in terms' - ) - ->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['default' => '1'], - 'Active status' - ) - ->addColumn( - 'is_processed', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['default' => '0'], - 'Processed status' - ) - ->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Updated at' - ) - ->addIndex( - $installer->getIdxName('search_query', ['query_text', 'store_id', 'popularity']), - ['query_text', 'store_id', 'popularity'] - ) - ->addIndex( - $installer->getIdxName('search_query', 'store_id'), - 'store_id' - ) - ->addIndex( - $installer->getIdxName('search_query', 'synonym_for'), - 'synonym_for' - ) - ->addForeignKey( - $installer->getFkName('search_query', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Search query table'); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php b/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php deleted file mode 100644 index 82d8dc589be82..0000000000000 --- a/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-2.0.0.php +++ /dev/null @@ -1,49 +0,0 @@ -startSetup(); - -$table = $installer->getConnection()->newTable( - $installer->getTable('sendfriend_log') -)->addColumn( - 'log_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Log ID' -)->addColumn( - 'ip', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - '20', - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer IP address' -)->addColumn( - 'time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Log time' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website ID' -)->addIndex( - $installer->getIdxName('sendfriend_log', 'ip'), - 'ip' -)->addIndex( - $installer->getIdxName('sendfriend_log', 'time'), - 'time' -)->setComment( - 'Send to friend function log storage table' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php b/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php deleted file mode 100644 index 25310453874fd..0000000000000 --- a/app/code/Magento/Sitemap/sql/sitemap_setup/install-2.0.0.php +++ /dev/null @@ -1,69 +0,0 @@ -startSetup(); - -/** - * Create table 'sitemap' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('sitemap') -)->addColumn( - 'sitemap_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Sitemap Id' -)->addColumn( - 'sitemap_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Sitemap Type' -)->addColumn( - 'sitemap_filename', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Sitemap Filename' -)->addColumn( - 'sitemap_path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sitemap Path' -)->addColumn( - 'sitemap_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Sitemap Time' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store id' -)->addIndex( - $installer->getIdxName('sitemap', ['store_id']), - ['store_id'] -)->addForeignKey( - $installer->getFkName('sitemap', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'XML Sitemap' -); - -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Store/sql/store_setup/install-2.0.0.php b/app/code/Magento/Store/sql/store_setup/install-2.0.0.php deleted file mode 100644 index 5e544cc05b9ab..0000000000000 --- a/app/code/Magento/Store/sql/store_setup/install-2.0.0.php +++ /dev/null @@ -1,279 +0,0 @@ -startSetup(); -$connection = $installer->getConnection(); - -/** - * Create table 'store_website' - */ -$table = $connection->newTable( - $installer->getTable('store_website') -)->addColumn( - 'website_id', - Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' -)->addColumn( - 'code', - Table::TYPE_TEXT, - 32, - [], - 'Code' -)->addColumn( - 'name', - Table::TYPE_TEXT, - 64, - [], - 'Website Name' -)->addColumn( - 'sort_order', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' -)->addColumn( - 'default_group_id', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Default Group Id' -)->addColumn( - 'is_default', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Defines Is Website Default' -)->addIndex( - $installer->getIdxName( - 'store_website', - ['code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('store_website', ['sort_order']), - ['sort_order'] -)->addIndex( - $installer->getIdxName('store_website', ['default_group_id']), - ['default_group_id'] -)->setComment( - 'Websites' -); -$connection->createTable($table); - -/** - * Create table 'store_group' - */ -$table = $connection->newTable( - $installer->getTable('store_group') -)->addColumn( - 'group_id', - Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Group Id' -)->addColumn( - 'website_id', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website Id' -)->addColumn( - 'name', - Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Store Group Name' -)->addColumn( - 'root_category_id', - Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Root Category Id' -)->addColumn( - 'default_store_id', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Default Store Id' -)->addIndex( - $installer->getIdxName('store_group', ['website_id']), - ['website_id'] -)->addIndex( - $installer->getIdxName('store_group', ['default_store_id']), - ['default_store_id'] -)->addForeignKey( - $installer->getFkName('store_group', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - Table::ACTION_CASCADE, - Table::ACTION_CASCADE -)->setComment( - 'Store Groups' -); -$connection->createTable($table); - -/** - * Create table 'store' - */ -$table = $connection->newTable( - $installer->getTable('store') -)->addColumn( - 'store_id', - Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store Id' -)->addColumn( - 'code', - Table::TYPE_TEXT, - 32, - [], - 'Code' -)->addColumn( - 'website_id', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website Id' -)->addColumn( - 'group_id', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Group Id' -)->addColumn( - 'name', - Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Store Name' -)->addColumn( - 'sort_order', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Sort Order' -)->addColumn( - 'is_active', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Activity' -)->addIndex( - $installer->getIdxName('store', ['code'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), - ['code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addIndex( - $installer->getIdxName('store', ['website_id']), - ['website_id'] -)->addIndex( - $installer->getIdxName('store', ['is_active', 'sort_order']), - ['is_active', 'sort_order'] -)->addIndex( - $installer->getIdxName('store', ['group_id']), - ['group_id'] -)->addForeignKey( - $installer->getFkName('store', 'group_id', 'store_group', 'group_id'), - 'group_id', - $installer->getTable('store_group'), - 'group_id', - Table::ACTION_CASCADE, - Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('store', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - Table::ACTION_CASCADE, - Table::ACTION_CASCADE -)->setComment( - 'Stores' -); -$connection->createTable($table); - -/** - * Insert websites - */ -$connection->insertForce( - $installer->getTable('store_website'), - [ - 'website_id' => 0, - 'code' => 'admin', - 'name' => 'Admin', - 'sort_order' => 0, - 'default_group_id' => 0, - 'is_default' => 0 - ] -); -$connection->insertForce( - $installer->getTable('store_website'), - [ - 'website_id' => 1, - 'code' => 'base', - 'name' => 'Main Website', - 'sort_order' => 0, - 'default_group_id' => 1, - 'is_default' => 1 - ] -); - -/** - * Insert store groups - */ -$connection->insertForce( - $installer->getTable('store_group'), - ['group_id' => 0, 'website_id' => 0, 'name' => 'Default', 'root_category_id' => 0, 'default_store_id' => 0] -); -$connection->insertForce( - $installer->getTable('store_group'), - [ - 'group_id' => 1, - 'website_id' => 1, - 'name' => 'Main Website Store', - 'root_category_id' => 2, - 'default_store_id' => 1 - ] -); - -/** - * Insert stores - */ -$connection->insertForce( - $installer->getTable('store'), - [ - 'store_id' => 0, - 'code' => 'admin', - 'website_id' => 0, - 'group_id' => 0, - 'name' => 'Admin', - 'sort_order' => 0, - 'is_active' => 1 - ] -); -$connection->insertForce( - $installer->getTable('store'), - [ - 'store_id' => 1, - 'code' => 'default', - 'website_id' => 1, - 'group_id' => 1, - 'name' => 'Default Store View', - 'sort_order' => 0, - 'is_active' => 1 - ] -); - -$installer->endSetup(); diff --git a/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php b/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php deleted file mode 100644 index a062644369494..0000000000000 --- a/app/code/Magento/Tax/sql/tax_setup/install-2.0.0.php +++ /dev/null @@ -1,500 +0,0 @@ -startSetup(); - -/** - * Create table 'tax_class' - */ -$table = $this->getConnection()->newTable( - $this->getTable('tax_class') -)->addColumn( - 'class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Class Id' -)->addColumn( - 'class_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Class Name' -)->addColumn( - 'class_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 8, - ['nullable' => false, 'default' => 'CUSTOMER'], - 'Class Type' -)->setComment( - 'Tax Class' -); -$this->getConnection()->createTable($table); - -/** - * Create table 'tax_calculation_rule' - */ -$table = $this->getConnection()->newTable( - $this->getTable('tax_calculation_rule') -)->addColumn( - 'tax_calculation_rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Tax Calculation Rule Id' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Code' -)->addColumn( - 'priority', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Priority' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Position' -)->addColumn( - 'calculate_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Calculate off subtotal option' -)->addIndex( - $this->getIdxName('tax_calculation_rule', ['priority', 'position']), - ['priority', 'position'] -)->addIndex( - $this->getIdxName('tax_calculation_rule', ['code']), - ['code'] -)->setComment( - 'Tax Calculation Rule' -); -$this->getConnection()->createTable($table); - -/** - * Create table 'tax_calculation_rate' - */ -$table = $this->getConnection()->newTable( - $this->getTable('tax_calculation_rate') -)->addColumn( - 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Tax Calculation Rate Id' -)->addColumn( - 'tax_country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - ['nullable' => false], - 'Tax Country Id' -)->addColumn( - 'tax_region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Tax Region Id' -)->addColumn( - 'tax_postcode', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 21, - [], - 'Tax Postcode' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Code' -)->addColumn( - 'rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Rate' -)->addColumn( - 'zip_is_range', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - [], - 'Zip Is Range' -)->addColumn( - 'zip_from', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Zip From' -)->addColumn( - 'zip_to', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Zip To' -)->addIndex( - $this->getIdxName('tax_calculation_rate', ['tax_country_id', 'tax_region_id', 'tax_postcode']), - ['tax_country_id', 'tax_region_id', 'tax_postcode'] -)->addIndex( - $this->getIdxName('tax_calculation_rate', ['code']), - ['code'] -)->addIndex( - $this->getIdxName( - 'tax_calculation_rate', - ['tax_calculation_rate_id', 'tax_country_id', 'tax_region_id', 'zip_is_range', 'tax_postcode'] - ), - ['tax_calculation_rate_id', 'tax_country_id', 'tax_region_id', 'zip_is_range', 'tax_postcode'] -)->setComment( - 'Tax Calculation Rate' -); -$this->getConnection()->createTable($table); - -/** - * Create table 'tax_calculation' - */ -$table = $this->getConnection()->newTable( - $this->getTable('tax_calculation') -)->addColumn( - 'tax_calculation_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Tax Calculation Id' -)->addColumn( - 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Tax Calculation Rate Id' -)->addColumn( - 'tax_calculation_rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Tax Calculation Rule Id' -)->addColumn( - 'customer_tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false], - 'Customer Tax Class Id' -)->addColumn( - 'product_tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false], - 'Product Tax Class Id' -)->addIndex( - $this->getIdxName('tax_calculation', ['tax_calculation_rule_id']), - ['tax_calculation_rule_id'] -)->addIndex( - $this->getIdxName('tax_calculation', ['customer_tax_class_id']), - ['customer_tax_class_id'] -)->addIndex( - $this->getIdxName('tax_calculation', ['product_tax_class_id']), - ['product_tax_class_id'] -)->addIndex( - $this->getIdxName( - 'tax_calculation', - ['tax_calculation_rate_id', 'customer_tax_class_id', 'product_tax_class_id'] - ), - ['tax_calculation_rate_id', 'customer_tax_class_id', 'product_tax_class_id'] -)->addForeignKey( - $this->getFkName('tax_calculation', 'product_tax_class_id', 'tax_class', 'class_id'), - 'product_tax_class_id', - $this->getTable('tax_class'), - 'class_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $this->getFkName('tax_calculation', 'customer_tax_class_id', 'tax_class', 'class_id'), - 'customer_tax_class_id', - $this->getTable('tax_class'), - 'class_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $this->getFkName( - 'tax_calculation', - 'tax_calculation_rate_id', - 'tax_calculation_rate', - 'tax_calculation_rate_id' - ), - 'tax_calculation_rate_id', - $this->getTable('tax_calculation_rate'), - 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $this->getFkName( - 'tax_calculation', - 'tax_calculation_rule_id', - 'tax_calculation_rule', - 'tax_calculation_rule_id' - ), - 'tax_calculation_rule_id', - $this->getTable('tax_calculation_rule'), - 'tax_calculation_rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Tax Calculation' -); -$this->getConnection()->createTable($table); - -/** - * Create table 'tax_calculation_rate_title' - */ -$table = $this->getConnection()->newTable( - $this->getTable('tax_calculation_rate_title') -)->addColumn( - 'tax_calculation_rate_title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Tax Calculation Rate Title Id' -)->addColumn( - 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Tax Calculation Rate Id' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Value' -)->addIndex( - $this->getIdxName('tax_calculation_rate_title', ['tax_calculation_rate_id', 'store_id']), - ['tax_calculation_rate_id', 'store_id'] -)->addIndex( - $this->getIdxName('tax_calculation_rate_title', ['store_id']), - ['store_id'] -)->addForeignKey( - $this->getFkName('tax_calculation_rate_title', 'store_id', 'store', 'store_id'), - 'store_id', - $this->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $this->getFkName( - 'tax_calculation_rate_title', - 'tax_calculation_rate_id', - 'tax_calculation_rate', - 'tax_calculation_rate_id' - ), - 'tax_calculation_rate_id', - $this->getTable('tax_calculation_rate'), - 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Tax Calculation Rate Title' -); -$this->getConnection()->createTable($table); - -/** - * Create table 'tax_order_aggregated_created' - */ -$table = $this->getConnection()->newTable( - $this->getTable('tax_order_aggregated_created') -)->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' -)->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => true], - 'Period' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Code' -)->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false], - 'Order Status' -)->addColumn( - 'percent', - \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, - null, - [], - 'Percent' -)->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Orders Count' -)->addColumn( - 'tax_base_amount_sum', - \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, - null, - [], - 'Tax Base Amount Sum' -)->addIndex( - $this->getIdxName( - 'tax_order_aggregated_created', - ['period', 'store_id', 'code', 'percent', 'order_status'], - true - ), - ['period', 'store_id', 'code', 'percent', 'order_status'], - ['type' => 'unique'] -)->addIndex( - $this->getIdxName('tax_order_aggregated_created', ['store_id']), - ['store_id'] -)->addForeignKey( - $this->getFkName('tax_order_aggregated_created', 'store_id', 'store', 'store_id'), - 'store_id', - $this->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Tax Order Aggregation' -); -$this->getConnection()->createTable($table); - -/** - * Create table 'tax_order_aggregated_updated' - */ -$this->getConnection()->createTable( - $this->getConnection()->createTableByDdl( - $this->getTable('tax_order_aggregated_created'), - $this->getTable('tax_order_aggregated_updated') - ) -); - -/** - * Create table 'sales_order_tax_item' - */ -$table = $this->getConnection()->newTable( - $this->getTable('sales_order_tax_item') -)->addColumn( - 'tax_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Tax Item Id' -)->addColumn( - 'tax_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Tax Id' -)->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true], - 'Item Id' -)->addColumn( - 'tax_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Real Tax Percent For Item' -)->addColumn( - 'amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Tax amount for the item and tax rate' -)->addColumn( - 'base_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Base tax amount for the item and tax rate' -)->addColumn( - 'real_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Real tax amount for the item and tax rate' -)->addColumn( - 'real_base_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Real base tax amount for the item and tax rate' -)->addColumn( - 'associated_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => true, 'unsigned' => true], - 'Id of the associated item' -)->addColumn( - 'taxable_item_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Type of the taxable item' -)->addIndex( - $this->getIdxName('sales_order_tax_item', ['item_id']), - ['item_id'] -)->addIndex( - $this->getIdxName( - 'sales_order_tax_item', - ['tax_id', 'item_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['tax_id', 'item_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $this->getFkName('sales_order_tax_item', 'associated_item_id', 'sales_order_item', 'item_id'), - 'associated_item_id', - $this->getTable('sales_order_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $this->getFkName('sales_order_tax_item', 'tax_id', 'sales_order_tax', 'tax_id'), - 'tax_id', - $this->getTable('sales_order_tax'), - 'tax_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $this->getFkName('sales_order_tax_item', 'item_id', 'sales_order_item', 'item_id'), - 'item_id', - $this->getTable('sales_order_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Sales Order Tax Item' -); -$this->getConnection()->createTable($table); - -$this->endSetup(); diff --git a/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php b/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php deleted file mode 100644 index c918656965670..0000000000000 --- a/app/code/Magento/Theme/sql/theme_setup/install-2.0.0.php +++ /dev/null @@ -1,144 +0,0 @@ -getConnection(); - -$installer->startSetup(); - -/** - * Create table 'theme' - */ -$table = $connection->newTable( - $installer->getTable('theme') -)->addColumn( - 'theme_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Theme identifier' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => true], - 'Parent Id' -)->addColumn( - 'theme_path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 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, - 255, - ['nullable' => false], - 'Theme Title' -)->addColumn( - 'preview_image', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Preview Image' -)->addColumn( - 'is_featured', - \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - null, - ['nullable' => false, 'default' => 0], - 'Is Theme Featured' -)->addColumn( - 'area', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Theme Area' -)->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false], - 'Theme type: 0:physical, 1:virtual, 2:staging' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'Full theme code, including package' -)->setComment( - 'Core theme' -); -$connection->createTable($table); - -/** - * Create table 'theme_file' - */ -$table = $connection->newTable( - $installer->getTable('theme_file') -)->addColumn( - 'theme_files_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Theme files identifier' -)->addColumn( - 'theme_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Theme Id' -)->addColumn( - 'file_path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Relative path to file' -)->addColumn( - 'file_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'File Type' -)->addColumn( - 'content', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - \Magento\Framework\DB\Ddl\Table::MAX_TEXT_SIZE, - ['nullable' => false], - 'File Content' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0], - 'Sort Order' -)->addColumn( - 'is_temporary', - \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - null, - ['nullable' => false, 'default' => 0], - 'Is Temporary File' -)->addForeignKey( - $installer->getFkName('theme_file', 'theme_id', 'theme', 'theme_id'), - 'theme_id', - $installer->getTable('theme'), - 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Core theme files' -); -$connection->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php b/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php deleted file mode 100644 index b8ce25b4f5056..0000000000000 --- a/app/code/Magento/Theme/sql/theme_setup/upgrade-2.0.0-2.0.1.php +++ /dev/null @@ -1,21 +0,0 @@ -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/Translation/sql/translation_setup/install-2.0.0.php b/app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php deleted file mode 100644 index dc3d9e161aeac..0000000000000 --- a/app/code/Magento/Translation/sql/translation_setup/install-2.0.0.php +++ /dev/null @@ -1,89 +0,0 @@ -startSetup(); - -/** - * Create table 'translation' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('translation')) - ->addColumn( - 'key_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [ - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], - 'Key Id of Translation' - )->addColumn( - 'string', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [ - 'nullable' => false, - 'default' => 'Translate String', - ], - 'Translation String' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - [ - 'unsigned' => true, - 'nullable' => false, - 'default' => '0', - ], - 'Store Id' - )->addColumn( - 'translate', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Translate' - )->addColumn( - 'locale', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - [ - 'nullable' => false, - 'default' => 'en_US', - ], - 'Locale' - )->addColumn( - 'crc_string', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - [ - 'nullable' => false, - 'default' => crc32('Translate String') - ], - 'Translation String CRC32 Hash' - )->addIndex( - $installer->getIdxName( - 'translation', - ['store_id', 'locale', 'crc_string', 'string'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['store_id', 'locale', 'crc_string', 'string'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('translation', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment('Translations'); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-2.0.0.php b/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-2.0.0.php deleted file mode 100644 index ae3c838723bbf..0000000000000 --- a/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-2.0.0.php +++ /dev/null @@ -1,107 +0,0 @@ -startSetup(); - -/** - * Create table 'url_rewrite' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('url_rewrite')) - ->addColumn( - 'url_rewrite_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rewrite Id' - ) - ->addColumn( - 'entity_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Entity type code' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Entity ID' - ) - ->addColumn( - 'request_path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Request Path' - ) - ->addColumn( - 'target_path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Target Path' - ) - ->addColumn( - 'redirect_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Redirect Type' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' - ) - ->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Description' - ) - ->addColumn( - 'is_autogenerated', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Is rewrite generated automatically flag' - ) - ->addColumn( - 'metadata', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Meta data for url rewrite' - ) - ->addIndex( - $installer->getIdxName( - 'url_rewrite', - ['request_path', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['request_path', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('url_rewrite', ['target_path']), - ['target_path'] - ) - ->addIndex( - $installer->getIdxName('url_rewrite', ['store_id', 'entity_id']), - ['store_id', 'entity_id'] - ) - ->setComment('Url Rewrites'); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/User/sql/user_setup/install-2.0.0.php b/app/code/Magento/User/sql/user_setup/install-2.0.0.php deleted file mode 100644 index 50960ad43043f..0000000000000 --- a/app/code/Magento/User/sql/user_setup/install-2.0.0.php +++ /dev/null @@ -1,127 +0,0 @@ -startSetup(); - -/** - * Create table 'admin_user' - */ -if (!$installer->getConnection()->isTableExists($installer->getTable('admin_user'))) { - $table = $installer->getConnection()->newTable( - $installer->getTable('admin_user') - )->addColumn( - 'user_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'User ID' - )->addColumn( - 'firstname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true], - 'User First Name' - )->addColumn( - 'lastname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true], - 'User Last Name' - )->addColumn( - 'email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 128, - ['nullable' => true], - 'User Email' - )->addColumn( - 'username', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - ['nullable' => true], - 'User Login' - )->addColumn( - 'password', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'User Password' - )->addColumn( - 'created', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], - 'User Created Time' - )->addColumn( - 'modified', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'User Modified Time' - )->addColumn( - 'logdate', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'User Last Login Time' - )->addColumn( - 'lognum', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'User Login Number' - )->addColumn( - 'reload_acl_flag', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Reload ACL' - )->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'User Is Active' - )->addColumn( - 'extra', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'User Extra Data' - )->addColumn( - 'rp_token', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 256, - ['nullable' => true, 'default' => null], - 'Reset Password Link Token' - )->addColumn( - 'rp_token_created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true, 'default' => null], - 'Reset Password Link Token Creation Date' - )->addColumn( - 'interface_locale', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 5, - ['nullable' => false, 'default' => 'en_US'], - 'Backend interface locale' - )->addIndex( - $installer->getIdxName( - 'admin_user', - ['username'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['username'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->setComment( - 'Admin User Table' - ); - $installer->getConnection()->createTable($table); -} -$installer->endSetup(); diff --git a/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php b/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php deleted file mode 100644 index 7eae2a1040ff7..0000000000000 --- a/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php +++ /dev/null @@ -1,84 +0,0 @@ -getTable('core_config_data'); -$connection = $installer->getConnection(); - -$oldToNewMethodCodesMap = [ - 'First-Class' => '0_FCLE', - 'First-Class Mail International Large Envelope' => 'INT_14', - 'First-Class Mail International Letter' => 'INT_13', - 'First-Class Mail International Letters' => 'INT_13', - 'First-Class Mail International Package' => 'INT_15', - 'First-Class Mail International Parcel' => 'INT_13', - 'First-Class Package International Service' => 'INT_15', - 'First-Class Mail' => '0_FCLE', - 'First-Class Mail Flat' => '0_FCLE', - 'First-Class Mail Large Envelope' => '0_FCLE', - 'First-Class Mail International' => 'INT_14', - 'First-Class Mail Letter' => '0_FCL', - 'First-Class Mail Parcel' => '0_FCP', - 'First-Class Mail Package' => '0_FCP', - 'Parcel Post' => '4', - 'Standard Post' => '4', - 'Media Mail' => '6', - 'Library Mail' => '7', - 'Express Mail' => '3', - 'Express Mail PO to PO' => '3', - 'Express Mail Flat Rate Envelope' => '13', - 'Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee' => '25', - 'Express Mail Sunday/Holiday Guarantee' => '23', - 'Express Mail Flat Rate Envelope Hold For Pickup' => '27', - 'Express Mail Hold For Pickup' => '2', - 'Global Express Guaranteed (GXG)' => 'INT_4', - 'Global Express Guaranteed Non-Document Rectangular' => 'INT_6', - 'Global Express Guaranteed Non-Document Non-Rectangular' => 'INT_7', - 'USPS GXG Envelopes' => 'INT_12', - 'Express Mail International' => 'INT_1', - 'Express Mail International Flat Rate Envelope' => 'INT_10', - 'Priority Mail' => '1', - 'Priority Mail Small Flat Rate Box' => '28', - 'Priority Mail Medium Flat Rate Box' => '17', - 'Priority Mail Large Flat Rate Box' => '22', - 'Priority Mail Flat Rate Envelope' => '16', - 'Priority Mail International' => 'INT_2', - 'Priority Mail International Flat Rate Envelope' => 'INT_8', - 'Priority Mail International Small Flat Rate Box' => 'INT_16', - 'Priority Mail International Medium Flat Rate Box' => 'INT_9', - 'Priority Mail International Large Flat Rate Box' => 'INT_11', -]; - -$select = $connection->select()->from( - $configDataTable -)->where( - 'path IN (?)', - ['carriers/usps/free_method', 'carriers/usps/allowed_methods'] -); -$oldConfigValues = $connection->fetchAll($select); - -foreach ($oldConfigValues as $oldValue) { - $newValue = ''; - if (stripos($oldValue['path'], 'free_method') && isset($oldToNewMethodCodesMap[$oldValue['value']])) { - $newValue = $oldToNewMethodCodesMap[$oldValue['value']]; - } elseif (stripos($oldValue['path'], 'allowed_methods')) { - $newValuesList = []; - foreach (explode(',', $oldValue['value']) as $shippingMethod) { - if (isset($oldToNewMethodCodesMap[$shippingMethod])) { - $newValuesList[] = $oldToNewMethodCodesMap[$shippingMethod]; - } - } - $newValue = implode(',', $newValuesList); - } else { - continue; - } - - if ($newValue && $newValue != $oldValue['value']) { - $whereConfigId = $connection->quoteInto('config_id = ?', $oldValue['config_id']); - $connection->update($configDataTable, ['value' => $newValue], $whereConfigId); - } -} diff --git a/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php b/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php deleted file mode 100644 index aa5c5328ed1f0..0000000000000 --- a/app/code/Magento/Weee/sql/weee_setup/install-2.0.0.php +++ /dev/null @@ -1,107 +0,0 @@ -startSetup(); -/** - * Create table 'weee_tax' - */ -$table = $this->getConnection()->newTable( - $this->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_TEXT, - 255, - ['nullable' => false, 'default' => '*'], - 'State' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Attribute Id' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Entity Type Id' -)->addIndex( - $this->getIdxName('weee_tax', ['website_id']), - ['website_id'] -)->addIndex( - $this->getIdxName('weee_tax', ['entity_id']), - ['entity_id'] -)->addIndex( - $this->getIdxName('weee_tax', ['country']), - ['country'] -)->addIndex( - $this->getIdxName('weee_tax', ['attribute_id']), - ['attribute_id'] -)->addForeignKey( - $this->getFkName('weee_tax', 'country', 'directory_country', 'country_id'), - 'country', - $this->getTable('directory_country'), - 'country_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $this->getFkName('weee_tax', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $this->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $this->getFkName('weee_tax', 'website_id', 'store_website', 'website_id'), - 'website_id', - $this->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $this->getFkName('weee_tax', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $this->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Weee Tax' -); -$this->getConnection()->createTable($table); - -$this->endSetup(); diff --git a/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php b/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php deleted file mode 100644 index af30de861eb00..0000000000000 --- a/app/code/Magento/Weee/sql/weee_setup/upgrade-2.0.0-2.0.0.1.php +++ /dev/null @@ -1,15 +0,0 @@ -startSetup(); -$connection = $installer->getConnection(); - -//Drop entity_type_id column for wee tax table -$connection->dropColumn($installer->getTable('weee_tax'), 'entity_type_id'); - -$installer->endSetup(); diff --git a/app/code/Magento/Widget/data/widget_setup/data-install-2.0.0.php b/app/code/Magento/Widget/data/widget_setup/data-install-2.0.0.php deleted file mode 100644 index e09107e5055f3..0000000000000 --- a/app/code/Magento/Widget/data/widget_setup/data-install-2.0.0.php +++ /dev/null @@ -1,20 +0,0 @@ -createMigrationSetup(); -$installer->startSetup(); - -$installer->appendClassAliasReplace( - 'widget_instance', - 'instance_type', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['instance_id'] -); -$installer->doUpdateClassAliases(); - -$installer->endSetup(); diff --git a/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php b/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php deleted file mode 100644 index 809b31e3951cf..0000000000000 --- a/app/code/Magento/Widget/sql/widget_setup/install-2.0.0.php +++ /dev/null @@ -1,276 +0,0 @@ -startSetup(); - -/** - * Create table 'widget' - */ -if (!$installer->getConnection()->isTableExists($installer->getTable('widget'))) { - $table = $installer->getConnection()->newTable( - $installer->getTable('widget') - )->addColumn( - 'widget_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Widget Id' - )->addColumn( - 'widget_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Widget code for template directive' - )->addColumn( - 'widget_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Widget Type' - )->addColumn( - 'parameters', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Parameters' - )->addIndex( - $installer->getIdxName('widget', 'widget_code'), - 'widget_code' - )->setComment( - 'Preconfigured Widgets' - ); - $installer->getConnection()->createTable($table); -} else { - $installer->getConnection()->dropIndex($installer->getTable('widget'), 'IDX_CODE'); - - $tables = [ - $installer->getTable( - 'widget' - ) => [ - 'columns' => [ - 'widget_id' => [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - 'comment' => 'Widget Id', - ], - 'parameters' => [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'length' => '64K', - 'comment' => 'Parameters', - ], - ], - 'comment' => 'Preconfigured Widgets', - ], - ]; - - $installer->getConnection()->modifyTables($tables); - - $installer->getConnection()->changeColumn( - $installer->getTable('widget'), - 'code', - 'widget_code', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'length' => 255, - 'comment' => 'Widget code for template directive' - ] - ); - - $installer->getConnection()->changeColumn( - $installer->getTable('widget'), - 'type', - 'widget_type', - ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Widget Type'] - ); - - $installer->getConnection()->addIndex( - $installer->getTable('widget'), - $installer->getIdxName('widget', ['widget_code']), - ['widget_code'] - ); -} - -/** - * Create table 'widget_instance' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('widget_instance') -)->addColumn( - 'instance_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Instance Id' -)->addColumn( - 'instance_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Instance Type' -)->addColumn( - 'theme_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Theme id' -)->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Widget Title' -)->addColumn( - 'store_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false, 'default' => '0'], - 'Store ids' -)->addColumn( - 'widget_parameters', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Widget parameters' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort order' -)->addForeignKey( - $installer->getFkName('widget_instance', 'theme_id', 'theme', 'theme_id'), - 'theme_id', - $installer->getTable('theme'), - 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Instances of Widget for Package Theme' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'widget_instance_page' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('widget_instance_page') -)->addColumn( - 'page_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Page Id' -)->addColumn( - 'instance_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Instance Id' -)->addColumn( - 'page_group', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 25, - [], - 'Block Group Type' -)->addColumn( - 'layout_handle', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Layout Handle' -)->addColumn( - 'block_reference', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Container' -)->addColumn( - 'page_for', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 25, - [], - 'For instance entities' -)->addColumn( - 'entities', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Catalog entities (comma separated)' -)->addColumn( - 'page_template', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Path to widget template' -)->addIndex( - $installer->getIdxName('widget_instance_page', 'instance_id'), - 'instance_id' -)->addForeignKey( - $installer->getFkName('widget_instance_page', 'instance_id', 'widget_instance', 'instance_id'), - 'instance_id', - $installer->getTable('widget_instance'), - 'instance_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Instance of Widget on Page' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'widget_instance_page_layout' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('widget_instance_page_layout') -)->addColumn( - 'page_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Page Id' -)->addColumn( - 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Layout Update Id' -)->addIndex( - $installer->getIdxName('widget_instance_page_layout', 'page_id'), - 'page_id' -)->addIndex( - $installer->getIdxName( - 'widget_instance_page_layout', - ['layout_update_id', 'page_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['layout_update_id', 'page_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('widget_instance_page_layout', 'page_id', 'widget_instance_page', 'page_id'), - 'page_id', - $installer->getTable('widget_instance_page'), - 'page_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('widget_instance_page_layout', 'layout_update_id', 'core_layout_update', 'layout_update_id'), - 'layout_update_id', - $installer->getTable('core_layout_update'), - 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Layout updates' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php b/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php deleted file mode 100644 index 4291d05b31deb..0000000000000 --- a/app/code/Magento/Wishlist/sql/wishlist_setup/install-2.0.0.php +++ /dev/null @@ -1,197 +0,0 @@ -startSetup(); - -/** - * Create table 'wishlist' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('wishlist') -)->addColumn( - 'wishlist_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Wishlist ID' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer ID' -)->addColumn( - 'shared', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sharing flag (0 or 1)' -)->addColumn( - 'sharing_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Sharing encrypted code' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Last updated date' -)->addIndex( - $installer->getIdxName('wishlist', 'shared'), - 'shared' -)->addIndex( - $installer->getIdxName('wishlist', 'customer_id', \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), - 'customer_id', - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] -)->addForeignKey( - $installer->getFkName('wishlist', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Wishlist main Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'wishlist_item' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('wishlist_item') -)->addColumn( - 'wishlist_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Wishlist item ID' -)->addColumn( - 'wishlist_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Wishlist ID' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => true], - 'Store ID' -)->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Add date and time' -)->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Short description of wish list item' -)->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Qty' -)->addIndex( - $installer->getIdxName('wishlist_item', 'wishlist_id'), - 'wishlist_id' -)->addForeignKey( - $installer->getFkName('wishlist_item', 'wishlist_id', 'wishlist', 'wishlist_id'), - 'wishlist_id', - $installer->getTable('wishlist'), - 'wishlist_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addIndex( - $installer->getIdxName('wishlist_item', 'product_id'), - 'product_id' -)->addForeignKey( - $installer->getFkName('wishlist_item', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addIndex( - $installer->getIdxName('wishlist_item', 'store_id'), - 'store_id' -)->addForeignKey( - $installer->getFkName('wishlist_item', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Wishlist items' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'wishlist_item_option' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('wishlist_item_option') -)->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Id' -)->addColumn( - 'wishlist_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Wishlist Item Id' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Product Id' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Code' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Value' -)->addForeignKey( - $installer->getFkName('wishlist_item_option', 'wishlist_item_id', 'wishlist_item', 'wishlist_item_id'), - 'wishlist_item_id', - $installer->getTable('wishlist_item'), - 'wishlist_item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Wishlist Item Option Table' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); From 3cbead5c2c1e15ec853e9c843f23eccded7f613e Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Fri, 13 Feb 2015 14:02:49 -0600 Subject: [PATCH 034/106] MAGETWO-34071: Create Data Install Scripts for Modules with Custom Setup Models - refactored Migration setup model --- .../Magento/CatalogRule/Setup/InstallData.php | 7 +-- app/code/Magento/Cms/Setup/InstallData.php | 4 +- app/code/Magento/Core/Setup/InstallData.php | 8 ++-- .../Magento/Customer/Setup/InstallData.php | 2 +- .../Magento/SalesRule/Setup/InstallData.php | 4 +- app/code/Magento/Theme/Setup/InstallData.php | 10 ++--- .../Framework/Module/Setup/Migration.php | 44 ++++++++++--------- setup/src/Magento/Setup/Module/DataSetup.php | 1 + 8 files changed, 42 insertions(+), 38 deletions(-) diff --git a/app/code/Magento/CatalogRule/Setup/InstallData.php b/app/code/Magento/CatalogRule/Setup/InstallData.php index 112852227906a..34354c9e2b2ee 100755 --- a/app/code/Magento/CatalogRule/Setup/InstallData.php +++ b/app/code/Magento/CatalogRule/Setup/InstallData.php @@ -8,6 +8,7 @@ namespace Magento\CatalogRule\Setup; +use Magento\Framework\Module\Setup\MigrationFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataResourceInterface; @@ -20,7 +21,7 @@ class InstallData implements InstallDataInterface public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); - $installer->startSetup(); + $setup->startSetup(); $installer->appendClassAliasReplace( 'catalogrule', @@ -38,8 +39,8 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa ); $installer->doUpdateClassAliases(); - - $installer->endSetup(); + + $setup->endSetup(); } } \ No newline at end of file diff --git a/app/code/Magento/Cms/Setup/InstallData.php b/app/code/Magento/Cms/Setup/InstallData.php index a85d2b4071ca0..1c2f4cd90bc81 100644 --- a/app/code/Magento/Cms/Setup/InstallData.php +++ b/app/code/Magento/Cms/Setup/InstallData.php @@ -312,7 +312,7 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa } $installer = $setup->createMigrationSetup(); - $installer->startSetup(); + $setup->startSetup(); $installer->appendClassAliasReplace( 'cms_block', @@ -345,7 +345,7 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa $installer->doUpdateClassAliases(); - $installer->endSetup(); + $setup->endSetup(); $cookieRestriction = $this->createPage()->load('privacy-policy-cookie-restriction-mode', 'identifier'); diff --git a/app/code/Magento/Core/Setup/InstallData.php b/app/code/Magento/Core/Setup/InstallData.php index 3b98e67b6e783..98f009eba81ff 100755 --- a/app/code/Magento/Core/Setup/InstallData.php +++ b/app/code/Magento/Core/Setup/InstallData.php @@ -20,7 +20,7 @@ class InstallData implements InstallDataInterface public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); - $installer->startSetup(); + $setup->startSetup(); $installer->appendClassAliasReplace( 'core_config_data', @@ -41,12 +41,12 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa /** * Delete rows by condition from authorization_rule */ - $tableName = $installer->getTable('authorization_rule'); + $tableName = $setup->getTable('authorization_rule'); if ($tableName) { - $installer->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']); + $setup->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']); } - $installer->endSetup(); + $setup->endSetup(); } } \ No newline at end of file diff --git a/app/code/Magento/Customer/Setup/InstallData.php b/app/code/Magento/Customer/Setup/InstallData.php index ac1bfe61983e2..c5ee3c2749d93 100644 --- a/app/code/Magento/Customer/Setup/InstallData.php +++ b/app/code/Magento/Customer/Setup/InstallData.php @@ -168,6 +168,6 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa ); $migrationSetup->doUpdateClassAliases(); - $migrationSetup->endSetup(); + $setup->endSetup(); } } diff --git a/app/code/Magento/SalesRule/Setup/InstallData.php b/app/code/Magento/SalesRule/Setup/InstallData.php index cbc44a56371ab..97e65d6e04579 100755 --- a/app/code/Magento/SalesRule/Setup/InstallData.php +++ b/app/code/Magento/SalesRule/Setup/InstallData.php @@ -20,7 +20,7 @@ class InstallData implements InstallDataInterface public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); - $installer->startSetup(); + $setup->startSetup(); $installer->appendClassAliasReplace( 'salesrule', @@ -39,7 +39,7 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa $installer->doUpdateClassAliases(); - $installer->endSetup(); + $setup->endSetup(); } } \ No newline at end of file diff --git a/app/code/Magento/Theme/Setup/InstallData.php b/app/code/Magento/Theme/Setup/InstallData.php index 47beadb387fb9..392031fc49312 100644 --- a/app/code/Magento/Theme/Setup/InstallData.php +++ b/app/code/Magento/Theme/Setup/InstallData.php @@ -39,12 +39,12 @@ public function __construct( public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); - $installer->startSetup(); + $setup->startSetup(); /* * Register themes */ - $installer->getEventManager()->dispatch('theme_registration_from_filesystem'); + $setup->getEventManager()->dispatch('theme_registration_from_filesystem'); /** * Update theme's data @@ -81,13 +81,13 @@ public function install(ModuleDataResourceInterface $setup, ModuleContextInterfa /** * Update rows in theme */ - $installer->getConnection()->update( - $installer->getTable('theme'), + $setup->getConnection()->update( + $setup->getTable('theme'), ['area' => 'frontend'], ['area = ?' => ''] ); - $installer->endSetup(); + $setup->endSetup(); } /** diff --git a/lib/internal/Magento/Framework/Module/Setup/Migration.php b/lib/internal/Magento/Framework/Module/Setup/Migration.php index f8ffa46888279..ebe1f236bd663 100644 --- a/lib/internal/Magento/Framework/Module/Setup/Migration.php +++ b/lib/internal/Magento/Framework/Module/Setup/Migration.php @@ -6,14 +6,15 @@ namespace Magento\Framework\Module\Setup; use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Filesystem; +use Magento\Setup\Module\DataSetup; /** * Resource setup model with methods needed for migration process between Magento versions * @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Migration extends \Magento\Setup\Module\DataSetup +class Migration { /**#@+ * Type of field content where class alias is used @@ -120,29 +121,30 @@ class Migration extends \Magento\Setup\Module\DataSetup protected $_directory; /** - * @var \Magento\Framework\Module\Setup\MigrationData + * @var MigrationData */ protected $_migrationData; /** - * @param \Magento\Framework\Module\Setup\Context $context - * @param \Magento\Framework\Module\Setup\MigrationData $migrationData + * @var DataSetup + */ + private $setup; + + /** + * @param DataSetup $setup + * @param Filesystem $filesystem + * @param MigrationData $migrationData * @param string $confPathToMapFile - * @param string $resourceName - * @param string $moduleName - * @param string $connectionName * @param array $compositeModules */ public function __construct( - \Magento\Framework\Module\Setup\Context $context, - $resourceName, - $moduleName, - \Magento\Framework\Module\Setup\MigrationData $migrationData, + DataSetup $setup, + Filesystem $filesystem, + MigrationData $migrationData, $confPathToMapFile, - $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION, $compositeModules = [] ) { - $this->_directory = $context->getFilesystem()->getDirectoryRead(DirectoryList::ROOT); + $this->_directory = $filesystem->getDirectoryRead(DirectoryList::ROOT); $this->_pathToMapFile = $confPathToMapFile; $this->_migrationData = $migrationData; $this->_replacePatterns = [ @@ -150,7 +152,7 @@ public function __construct( self::FIELD_CONTENT_TYPE_XML => $this->_migrationData->getXmlFindPattern(), ]; $this->_compositeModules = $compositeModules; - parent::__construct($context, $resourceName, $moduleName, $connectionName); + $this->setup = $setup; } /** @@ -228,10 +230,10 @@ protected function _updateClassAliasesInTable($tableName, array $tableRules) */ protected function _getRowsCount($tableName, $fieldName, $additionalWhere = '') { - $adapter = $this->getConnection(); + $adapter = $this->setup->getConnection(); $query = $adapter->select()->from( - $this->getTable($tableName), + $this->setup->getTable($tableName), ['rows_count' => new \Zend_Db_Expr('COUNT(*)')] )->where( $fieldName . ' IS NOT NULL' @@ -302,14 +304,14 @@ protected function _applyFieldRule($tableName, $fieldName, array $fieldRule, $cu protected function _updateRowsData($tableName, $fieldName, array $fieldReplacements) { if (count($fieldReplacements) > 0) { - $adapter = $this->getConnection(); + $adapter = $this->setup->getConnection(); foreach ($fieldReplacements as $fieldReplacement) { $where = []; foreach ($fieldReplacement['where_fields'] as $whereFieldName => $value) { $where[$adapter->quoteIdentifier($whereFieldName) . ' = ?'] = $value; } - $adapter->update($this->getTable($tableName), [$fieldName => $fieldReplacement['to']], $where); + $adapter->update($this->setup->getTable($tableName), [$fieldName => $fieldReplacement['to']], $where); } } } @@ -331,10 +333,10 @@ protected function _getTableData( $additionalWhere = '', $currPage = 0 ) { - $adapter = $this->getConnection(); + $adapter = $this->setup->getConnection(); $query = $adapter->select()->from( - $this->getTable($tableName), + $this->setup->getTable($tableName), $fieldsToSelect )->where( $fieldName . ' IS NOT NULL' diff --git a/setup/src/Magento/Setup/Module/DataSetup.php b/setup/src/Magento/Setup/Module/DataSetup.php index 04b00a94429b0..e7a0e16ab952d 100644 --- a/setup/src/Magento/Setup/Module/DataSetup.php +++ b/setup/src/Magento/Setup/Module/DataSetup.php @@ -477,6 +477,7 @@ public function getFilesystem() */ public function createMigrationSetup(array $data = []) { + $data['setup'] = $this; return $this->_migrationFactory->create($data); } } From c9665f8ca15d6633573f538e69f4fd2611171ec8 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Fri, 13 Feb 2015 14:54:59 -0600 Subject: [PATCH 035/106] MAGETWO-34071: Create Data Install Scripts for Modules with Custom Setup Models - removed setup model of Integration module --- .../Integration/Model/Resource/Setup.php | 53 ------------------- .../Model/Plugin/{Setup.php => Manager.php} | 10 ++-- app/code/Magento/Webapi/etc/frontend/di.xml | 4 +- .../Plugin/{SetupTest.php => ManagerTest.php} | 24 ++++----- 4 files changed, 19 insertions(+), 72 deletions(-) delete mode 100644 app/code/Magento/Integration/Model/Resource/Setup.php rename app/code/Magento/Webapi/Model/Plugin/{Setup.php => Manager.php} (90%) rename dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/{SetupTest.php => ManagerTest.php} (85%) diff --git a/app/code/Magento/Integration/Model/Resource/Setup.php b/app/code/Magento/Integration/Model/Resource/Setup.php deleted file mode 100644 index 421a3fe8518cf..0000000000000 --- a/app/code/Magento/Integration/Model/Resource/Setup.php +++ /dev/null @@ -1,53 +0,0 @@ -_integrationManager = $integrationManager; - parent::__construct($context, $resourceName, $moduleName, $connectionName); - } - - /** - * Initiate integration processing - * - * @param array $integrationNames - * @return array of integration names sent to the next invocation - */ - public function initIntegrationProcessing(array $integrationNames) - { - $this->_integrationManager->processIntegrationConfig($integrationNames); - return $integrationNames; - } -} diff --git a/app/code/Magento/Webapi/Model/Plugin/Setup.php b/app/code/Magento/Webapi/Model/Plugin/Manager.php similarity index 90% rename from app/code/Magento/Webapi/Model/Plugin/Setup.php rename to app/code/Magento/Webapi/Model/Plugin/Manager.php index 6c5362ad139f6..fcc9d954e53d7 100644 --- a/app/code/Magento/Webapi/Model/Plugin/Setup.php +++ b/app/code/Magento/Webapi/Model/Plugin/Manager.php @@ -10,10 +10,10 @@ use Magento\Webapi\Model\IntegrationConfig; /** - * Plugin for Magento\Framework\Module\Setup model to manage resource permissions of + * Plugin for \Magento\Integration\Model\Manager model to manage resource permissions of * integration installed from config file */ -class Setup +class Manager { /** * API Integration config @@ -54,14 +54,14 @@ public function __construct( /** * Process integration resource permissions after the integration is created * - * @param \Magento\Integration\Model\Resource\Setup $subject + * @param \Magento\Integration\Model\Manager $subject * @param string[] $integrationNames Name of integrations passed as array from the invocation chain * * @return string[] * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterInitIntegrationProcessing( - \Magento\Integration\Model\Resource\Setup $subject, + public function afterProcessIntegrationConfig( + \Magento\Integration\Model\Manager $subject, $integrationNames ) { if (empty($integrationNames)) { diff --git a/app/code/Magento/Webapi/etc/frontend/di.xml b/app/code/Magento/Webapi/etc/frontend/di.xml index 9e2ac2da15f9f..1816cdb4cd3fd 100644 --- a/app/code/Magento/Webapi/etc/frontend/di.xml +++ b/app/code/Magento/Webapi/etc/frontend/di.xml @@ -7,7 +7,7 @@ --> - - + + diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/SetupTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/ManagerTest.php similarity index 85% rename from dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/SetupTest.php rename to dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/ManagerTest.php index 56680c43390c0..952b69b6ba445 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/SetupTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/ManagerTest.php @@ -7,38 +7,38 @@ use Magento\Integration\Model\Integration; -class SetupTest extends \PHPUnit_Framework_TestCase +class ManagerTest extends \PHPUnit_Framework_TestCase { /** * API Integration config * - * @var \Magento\Webapi\Model\IntegrationConfig + * @var \Magento\Webapi\Model\IntegrationConfig|\PHPUnit_Framework_MockObject_MockObject */ protected $integrationConfigMock; /** * Integration service mock * - * @var \Magento\Integration\Service\V1\IntegrationInterface + * @var \Magento\Integration\Service\V1\IntegrationInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $integrationServiceMock; /** * Authorization service mock * - * @var \Magento\Integration\Service\V1\AuthorizationService + * @var \Magento\Integration\Service\V1\AuthorizationService|\PHPUnit_Framework_MockObject_MockObject */ protected $integrationAuthorizationServiceMock; /** * API setup plugin * - * @var \Magento\Webapi\Model\Plugin\Setup + * @var \Magento\Webapi\Model\Plugin\Manager */ protected $apiSetupPlugin; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Integration\Model\Manager|\PHPUnit_Framework_MockObject_MockObject */ protected $subjectMock; @@ -62,26 +62,26 @@ public function setUp() ['grantPermissions'] )->getMock(); - $this->subjectMock = $this->getMock('Magento\Integration\Model\Resource\Setup', [], [], '', false); - $this->apiSetupPlugin = new \Magento\Webapi\Model\Plugin\Setup( + $this->subjectMock = $this->getMock('Magento\Integration\Model\Manager', [], [], '', false); + $this->apiSetupPlugin = new \Magento\Webapi\Model\Plugin\Manager( $this->integrationConfigMock, $this->integrationAuthorizationServiceMock, $this->integrationServiceMock ); } - public function testAfterInitIntegrationProcessingNoIntegrations() + public function testAfterProcessIntegrationConfigNoIntegrations() { $this->integrationConfigMock->expects($this->never())->method('getIntegrations'); $this->integrationServiceMock->expects($this->never())->method('findByName'); - $this->apiSetupPlugin->afterInitIntegrationProcessing($this->subjectMock, []); + $this->apiSetupPlugin->afterProcessIntegrationConfig($this->subjectMock, []); } /** * @return void * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testAfterInitIntegrationProcessingSuccess() + public function testAfterProcessIntegrationConfigSuccess() { $testIntegration1Resource = [ 'Magento_Customer::manage', @@ -144,7 +144,7 @@ public function testAfterInitIntegrationProcessingSuccess() $this->returnValue($integrationsData2) ); - $this->apiSetupPlugin->afterInitIntegrationProcessing( + $this->apiSetupPlugin->afterProcessIntegrationConfig( $this->subjectMock, ['TestIntegration1', 'TestIntegration2'] ); From 2dad0d5e0d88430d31bbba601bfa3a3628a5853c Mon Sep 17 00:00:00 2001 From: Safwan Khan Date: Tue, 17 Feb 2015 09:50:48 -0600 Subject: [PATCH 036/106] MAGETWO-33888: Change setup framework to use SPI classes - Refactored setup FW to use SPIs. --- .../Magento/Framework/Module/Updater.php | 28 ++- .../Setup/ModuleDataResourceInterface.php | 7 - setup/src/Magento/Setup/Model/Installer.php | 84 ++++--- .../Magento/Setup/Model/InstallerFactory.php | 25 ++- setup/src/Magento/Setup/Module/DataSetup.php | 212 ------------------ .../Module/ModuleInstallerUpgraderFactory.php | 117 ++++++++++ .../src/Magento/Setup/Module/SetupFactory.php | 42 +--- 7 files changed, 225 insertions(+), 290 deletions(-) create mode 100644 setup/src/Magento/Setup/Module/ModuleInstallerUpgraderFactory.php diff --git a/lib/internal/Magento/Framework/Module/Updater.php b/lib/internal/Magento/Framework/Module/Updater.php index 8d986b64d8688..d2b41c3e8cb2e 100644 --- a/lib/internal/Magento/Framework/Module/Updater.php +++ b/lib/internal/Magento/Framework/Module/Updater.php @@ -7,6 +7,8 @@ */ namespace Magento\Framework\Module; +use Magento\Setup\Module\ModuleInstallerUpgraderFactory; + class Updater { /** @@ -50,14 +52,36 @@ public function __construct( /** * Apply database data updates whenever needed * + * @param \Magento\Framework\Module\Resource $resource + * @param ModuleInstallerUpgraderFactory $moduleInstallerUpgraderFactory * @return void */ - public function updateData() + public function updateData($resource, $moduleInstallerUpgraderFactory) { foreach ($this->_moduleList->getNames() as $moduleName) { foreach ($this->_resourceResolver->getResourceList($moduleName) as $resourceName) { if (!$this->_dbVersionInfo->isDataUpToDate($moduleName, $resourceName)) { - $this->_setupFactory->create($resourceName, $moduleName)->applyDataUpdates(); + $moduleDataResource = $this->_setupFactory->create($resourceName, $moduleName); + $dataVer = $resource->getDataVersion($moduleName); + $moduleConfig = $this->_moduleList->getOne($moduleName); + $configVer = $moduleConfig['setup_version']; + $moduleContext = new \Magento\Setup\Model\ModuleContext($dataVer); + if ($dataVer !== false) { + $status = version_compare($configVer, $dataVer); + if ($status == \Magento\Framework\Setup\ModuleDataResourceInterface::VERSION_COMPARE_GREATER) { + $moduleUpgrader = $moduleInstallerUpgraderFactory->createDataUpgrader($moduleName); + if ($moduleUpgrader) { + $moduleUpgrader->upgrade($moduleDataResource, $moduleContext); + $resource->setDataVersion($moduleName, $configVer); + } + } + } elseif ($configVer) { + $moduleInstaller = $moduleInstallerUpgraderFactory->createDataInstaller($moduleName); + if ($moduleInstaller) { + $moduleInstaller->install($moduleDataResource, $moduleContext); + $resource->setDataVersion($moduleName, $configVer); + } + } } } } diff --git a/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php b/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php index 945ce85589c1c..7e5a634a8aff0 100644 --- a/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php +++ b/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php @@ -22,13 +22,6 @@ interface ModuleDataResourceInterface extends ResourceInterface const TYPE_DATA_UPGRADE = 'data-upgrade'; - /** - * Apply data updates to the system after upgrading. - * - * @return $this - */ - public function applyDataUpdates(); - /** * Retrieve row or field from table by id or string and parent id * diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 0edb37ad8a492..4f8b5bf36485c 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -25,7 +25,10 @@ use Magento\Framework\Shell\CommandRenderer; use Magento\Setup\Module\ConnectionFactory; use Magento\Setup\Module\SetupFactory; +use Magento\Setup\Module\Setup; use Magento\Store\Model\Store; +use Magento\Setup\Module\ModuleInstallerUpgraderFactory; + /** * Class Installer contains the logic to install Magento application. @@ -86,9 +89,9 @@ class Installer /** * Resource setup factory * - * @var SetupFactory; + * @var Setup; */ - private $setupFactory; + private $setup; /** * Module list @@ -194,6 +197,17 @@ class Installer */ private $objectManagerFactory; + /** + * @var \Magento\Framework\Module\Resource + */ + private $resource; + + /** + * + * @var ModuleInstallerUpgraderFactory + */ + private $moduleInstallerUpgraderFactory; + /** * Constructor * @@ -212,6 +226,8 @@ class Installer * @param Filesystem $filesystem * @param SampleData $sampleData * @param ObjectManagerFactory $objectManagerFactory + * @param \Magento\Framework\App\Resource $resource + * @param ModuleInstallerUpgraderFactory $moduleInstallerUpgraderFactory */ public function __construct( FilePermissions $filePermissions, @@ -228,11 +244,13 @@ public function __construct( MaintenanceMode $maintenanceMode, Filesystem $filesystem, SampleData $sampleData, - ObjectManagerFactory $objectManagerFactory + ObjectManagerFactory $objectManagerFactory, + \Magento\Framework\App\Resource $resource, + ModuleInstallerUpgraderFactory $moduleInstallerUpgraderFactory ) { $this->filePermissions = $filePermissions; $this->deploymentConfigWriter = $deploymentConfigWriter; - $this->setupFactory = $setupFactory; + $this->setup = $setupFactory->createSetup($resource); $this->moduleList = $moduleList; $this->moduleLoader = $moduleLoader; $this->directoryList = $directoryList; @@ -247,6 +265,8 @@ public function __construct( $this->installInfo[self::INFO_MESSAGE] = array(); $this->deploymentConfig = $deploymentConfig; $this->objectManagerFactory = $objectManagerFactory; + $this->resource = new \Magento\Framework\Module\Resource($resource); + $this->moduleInstallerUpgraderFactory = $moduleInstallerUpgraderFactory; } /** @@ -545,14 +565,13 @@ public function installDeploymentConfig($data) */ private function setupModuleRegistry() { - $registrySetup = $this->setupFactory->createSetup(); - $connection = $registrySetup->getConnection(); + $connection = $this->setup->getConnection(); - if (!$connection->isTableExists($registrySetup->getTable('setup_module'))) { + if (!$connection->isTableExists($this->setup->getTable('setup_module'))) { /** * Create table 'setup_module' */ - $table = $connection->newTable($registrySetup->getTable('setup_module')) + $table = $connection->newTable($this->setup->getTable('setup_module')) ->addColumn( 'module', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, @@ -587,22 +606,31 @@ public function installSchema() $this->assertDbAccessible(); $this->setupModuleRegistry(); - $moduleNames = $this->moduleList->getNames(); - $this->log->log('Schema creation/updates:'); - foreach ($moduleNames as $moduleName) { + foreach ($this->moduleList->getNames() as $moduleName) { $this->log->log("Module '{$moduleName}':"); - $setup = $this->setupFactory->createSetupModule($this->log, $moduleName); - $setup->applyUpdates(); + $dbVer = $this->resource->getDbVersion($moduleName); + $moduleConfig = $this->moduleList->getOne($moduleName); + $configVer = $moduleConfig['setup_version']; + $moduleContext = new ModuleContext($moduleConfig); + // Module is installed + if ($dbVer !== false) { + if (version_compare($configVer, $dbVer, '>')) { + $moduleUpgrader = $this->moduleInstallerUpgraderFactory->createSchemaUpgrader($moduleName); + if ($moduleUpgrader) { + $moduleUpgrader->upgrade($this->setup, $moduleContext); + $this->resource->setDbVersion($moduleName, $configVer); + } + } + } elseif ($configVer) { + $moduleInstaller = $this->moduleInstallerUpgraderFactory->createSchemaInstaller($moduleName); + if ($moduleInstaller) { + $moduleInstaller->install($this->setup, $moduleContext); + $this->resource->setDbVersion($moduleName, $configVer); + } + } $this->logProgress(); } - - $this->log->log('Schema post-updates:'); - foreach ($moduleNames as $moduleName) { - $this->log->log("Module '{$moduleName}':"); - $setup = $this->setupFactory->createSetupModule($this->log, $moduleName); - $setup->applyRecurringUpdates(); - } } /** @@ -619,7 +647,7 @@ public function installDataFixtures() /** @var \Magento\Framework\Module\Updater $updater */ $updater = $this->getObjectManager()->create('Magento\Framework\Module\Updater'); - $updater->updateData(); + $updater->updateData($this->resource, $this->moduleInstallerUpgraderFactory); } /** @@ -653,18 +681,17 @@ public function installUserConfig($data) */ private function installOrderIncrementPrefix($orderIncrementPrefix) { - $setup = $this->setupFactory->createSetup($this->log); - $dbConnection = $setup->getConnection(); + $dbConnection = $this->setup->getConnection(); // get entity_type_id for order $select = $dbConnection->select() - ->from($setup->getTable('eav_entity_type'), 'entity_type_id') + ->from($this->setup->getTable('eav_entity_type'), 'entity_type_id') ->where('entity_type_code = \'order\''); $entityTypeId = $dbConnection->fetchOne($select); // See if row already exists $incrementRow = $dbConnection->fetchRow( - 'SELECT * FROM ' . $setup->getTable('eav_entity_store') . ' WHERE entity_type_id = ? AND store_id = ?', + 'SELECT * FROM ' . $this->setup->getTable('eav_entity_store') . ' WHERE entity_type_id = ? AND store_id = ?', [$entityTypeId, Store::DISTRO_STORE_ID] ); @@ -672,7 +699,7 @@ private function installOrderIncrementPrefix($orderIncrementPrefix) // row exists, update it $entityStoreId = $incrementRow['entity_store_id']; $dbConnection->update( - $setup->getTable('eav_entity_store'), + $this->setup->getTable('eav_entity_store'), ['increment_prefix' => $orderIncrementPrefix], ['entity_store_id' => $entityStoreId] ); @@ -683,7 +710,7 @@ private function installOrderIncrementPrefix($orderIncrementPrefix) 'store_id' => Store::DISTRO_STORE_ID, 'increment_prefix' => $orderIncrementPrefix, ]; - $dbConnection->insert($setup->getTable('eav_entity_store'), $rowData); + $dbConnection->insert($this->setup->getTable('eav_entity_store'), $rowData); } } @@ -696,8 +723,7 @@ private function installOrderIncrementPrefix($orderIncrementPrefix) public function installAdminUser($data) { $this->assertDeploymentConfigExists(); - $setup = $this->setupFactory->createSetup($this->log); - $adminAccount = $this->adminAccountFactory->create($setup, (array)$data); + $adminAccount = $this->adminAccountFactory->create($this->setup, (array)$data); $adminAccount->save(); } diff --git a/setup/src/Magento/Setup/Model/InstallerFactory.php b/setup/src/Magento/Setup/Model/InstallerFactory.php index 3aea75e7a6925..bb6f9b0d1b191 100644 --- a/setup/src/Magento/Setup/Model/InstallerFactory.php +++ b/setup/src/Magento/Setup/Model/InstallerFactory.php @@ -7,6 +7,7 @@ namespace Magento\Setup\Model; use Zend\ServiceManager\ServiceLocatorInterface; +use Magento\Setup\Module\ResourceFactory; class InstallerFactory { @@ -17,14 +18,23 @@ class InstallerFactory */ protected $serviceLocator; + /** + * @var ResourceFactory + */ + private $resourceFactory; + /** * Constructor * * @param ServiceLocatorInterface $serviceLocator */ - public function __construct(ServiceLocatorInterface $serviceLocator) + public function __construct( + ServiceLocatorInterface $serviceLocator, + ResourceFactory $resourceFactory + ) { $this->serviceLocator = $serviceLocator; + $this->resourceFactory = $resourceFactory; } /** @@ -50,7 +60,18 @@ public function create(LoggerInterface $log) $this->serviceLocator->get('Magento\Framework\App\MaintenanceMode'), $this->serviceLocator->get('Magento\Framework\Filesystem'), $this->serviceLocator->get('Magento\Setup\Model\SampleData'), - $this->serviceLocator->get('Magento\Setup\Model\ObjectManagerFactory') + $this->serviceLocator->get('Magento\Setup\Model\ObjectManagerFactory'), + $this->getResource(), + $this->serviceLocator->get('Magento\Setup\Module\ModuleInstallerUpgraderFactory') + ); + } + + private function getResource() + { + $deploymentConfig = new \Magento\Framework\App\DeploymentConfig( + $this->serviceLocator->get('Magento\Framework\App\DeploymentConfig\Reader'), + [] ); + return $this->resourceFactory->create($deploymentConfig); } } diff --git a/setup/src/Magento/Setup/Module/DataSetup.php b/setup/src/Magento/Setup/Module/DataSetup.php index 04b00a94429b0..bb2098d1acd9d 100644 --- a/setup/src/Magento/Setup/Module/DataSetup.php +++ b/setup/src/Magento/Setup/Module/DataSetup.php @@ -110,218 +110,6 @@ public function __construct( $this->modulesDir = $this->filesystem->getDirectoryRead(DirectoryList::MODULES); } - /** - * Apply data updates to the system after upgrading. - * - * @return $this - */ - public function applyDataUpdates() - { - $dataVer = $this->_resource->getDataVersion($this->moduleName); - $configVer = $this->_moduleConfig['setup_version']; - if ($dataVer !== false) { - $status = version_compare($configVer, $dataVer); - if ($status == self::VERSION_COMPARE_GREATER) { - $this->_upgradeData($dataVer, $configVer); - } - } elseif ($configVer) { - $this->_installData($configVer); - } - return $this; - } - - /** - * Run data install scripts - * - * @param string $newVersion - * @return $this - */ - private function _installData($newVersion) - { - $oldVersion = $this->_modifyResourceDb(self::TYPE_DATA_INSTALL, '', $newVersion); - $this->_modifyResourceDb(self::TYPE_DATA_UPGRADE, $oldVersion, $newVersion); - $this->_resource->setDataVersion($this->moduleName, $newVersion); - - return $this; - } - - /** - * Run data upgrade scripts - * - * @param string $oldVersion - * @param string $newVersion - * @return $this - */ - private function _upgradeData($oldVersion, $newVersion) - { - $this->_modifyResourceDb('data-upgrade', $oldVersion, $newVersion); - $this->_resource->setDataVersion($this->moduleName, $newVersion); - - return $this; - } - - /** - * Retrieve available Data install/upgrade files for current module - * - * @param string $actionType - * @param string $fromVersion - * @param string $toVersion - * @return array - */ - private function _getAvailableDataFiles($actionType, $fromVersion, $toVersion) - { - $modName = (string)$this->_moduleConfig['name']; - $files = []; - - $filesDir = $this->_modulesReader->getModuleDir('data', $modName) . '/' . $this->_resourceName; - $modulesDirPath = $this->modulesDir->getRelativePath($filesDir); - if ($this->modulesDir->isDirectory($modulesDirPath) && $this->modulesDir->isReadable($modulesDirPath)) { - $regExp = sprintf('#%s-(.*)\.php$#i', $actionType); - foreach ($this->modulesDir->read($modulesDirPath) as $file) { - $matches = []; - if (preg_match($regExp, $file, $matches)) { - $files[$matches[1]] = $this->modulesDir->getAbsolutePath($file); - } - } - } - - if (empty($files)) { - return []; - } - - return $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $files); - } - - /** - * Run module modification files. Return version of last applied upgrade (false if no upgrades applied) - * @param string $actionType - * @param string $fromVersion - * @param string $toVersion - * @return false|string - * @throws \Magento\Framework\Exception - */ - private function _modifyResourceDb($actionType, $fromVersion, $toVersion) - { - $files = $this->_getAvailableDataFiles($actionType, $fromVersion, $toVersion); - if (empty($files) || !$this->getConnection()) { - return false; - } - - $version = false; - - foreach ($files as $file) { - $fileName = $file['fileName']; - $fileType = pathinfo($fileName, PATHINFO_EXTENSION); - $this->getConnection()->disallowDdlCache(); - try { - switch ($fileType) { - case 'php': - $result = $this->_includeFile($fileName); - break; - case 'sql': - $sql = $this->modulesDir->readFile($this->modulesDir->getRelativePath($fileName)); - if (!empty($sql)) { - $result = $this->run($sql); - } else { - $result = true; - } - break; - default: - $result = false; - break; - } - - if ($result) { - $this->_resource->setDataVersion($this->moduleName, $file['toVersion']); - $this->_logger->debug($fileName); - } else { - $this->_logger->debug("Failed resource setup: {$fileName}"); - } - } catch (\Exception $e) { - throw new \Magento\Framework\Exception( - sprintf('Error in file: "%s" - %s', $fileName, $e->getMessage()), - 0, - $e - ); - } - $version = $file['toVersion']; - $this->getConnection()->allowDdlCache(); - } - return $version; - } - - /** - * Include file by path - * This method should perform only file inclusion. - * Implemented to prevent possibility of changing important and used variables - * inside the setup model while installing - * - * @param string $fileName - * @return mixed - */ - private function _includeFile($fileName) - { - return include $fileName; - } - - /** - * Get data files for modifications - * - * @param string $actionType - * @param string $fromVersion - * @param string $toVersion - * @param array $arrFiles - * @return array - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - */ - private function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles) - { - $arrRes = []; - switch ($actionType) { - case self::TYPE_DATA_INSTALL: - uksort($arrFiles, 'version_compare'); - foreach ($arrFiles as $version => $file) { - if (version_compare($version, $toVersion) !== self::VERSION_COMPARE_GREATER) { - $arrRes[0] = [ - 'toVersion' => $version, - 'fileName' => $file, - ]; - } - } - break; - - case self::TYPE_DATA_UPGRADE: - uksort($arrFiles, 'version_compare'); - foreach ($arrFiles as $version => $file) { - $versionInfo = explode('-', $version); - - // In array must be 2 elements: 0 => version from, 1 => version to - if (count($versionInfo) !== 2) { - break; - } - $infoFrom = $versionInfo[0]; - $infoTo = $versionInfo[1]; - if (version_compare($infoFrom, $fromVersion, '>=') - && version_compare($infoTo, $fromVersion, '>') - && version_compare($infoTo, $toVersion, '<=') - && version_compare($infoFrom, $toVersion, '<') - ) { - $arrRes[] = [ - 'toVersion' => $infoTo, - 'fileName' => $file, - ]; - } - } - break; - - default: - break; - } - return $arrRes; - } - - /******************* UTILITY METHODS *****************/ - /** * {@inheritdoc} */ diff --git a/setup/src/Magento/Setup/Module/ModuleInstallerUpgraderFactory.php b/setup/src/Magento/Setup/Module/ModuleInstallerUpgraderFactory.php new file mode 100644 index 0000000000000..5cb57cc75223b --- /dev/null +++ b/setup/src/Magento/Setup/Module/ModuleInstallerUpgraderFactory.php @@ -0,0 +1,117 @@ +serviceLocator = $serviceLocator; + $this->directoryList = $directoryList; + } + + /** + * Creates schema installer for a module + * + * @param $moduleName + * @return InstallSchemaInterface | null + */ + public function createSchemaInstaller($moduleName) + { + $modulePath = str_replace('_', '/', $moduleName); + $schemaInstaller = $this->directoryList->getPath(DirectoryList::MODULES) + . '/' . $modulePath . '/Setup/InstallSchema'; + return $this->getInstallerUpgrader($schemaInstaller); + } + + /** + * Creates schema upgrader for a module + * + * @param $moduleName + * @return UpgradeSchemaInterface | null + */ + public function createSchemaUpgrader($moduleName) + { + $modulePath = str_replace('_', '/', $moduleName); + $schemaUpgrader = $this->directoryList->getPath(DirectoryList::MODULES) + . '/' . $modulePath . '/Setup/UpgradeSchema'; + return $this->getInstallerUpgrader($schemaUpgrader); + } + + /** + * Creates data installer for a module + * + * @param $moduleName + * @return InstallDataInterface | null + */ + public function createDataInstaller($moduleName) + { + $modulePath = str_replace('_', '/', $moduleName); + $dataInstaller = $this->directoryList->getPath(DirectoryList::MODULES) + . '/' . $modulePath . '/Setup/InstallData'; + return $this->getInstallerUpgrader($dataInstaller); + } + + /** + * Creates data upgrader for a module + * + * @param $moduleName + * @return UpgradeDataInterface | null + */ + public function createDataUpgrader($moduleName) + { + $modulePath = str_replace('_', '/', $moduleName); + $dataUgrader = $this->directoryList->getPath(DirectoryList::MODULES) + . '/' . $modulePath . '/Setup/UpgradeData'; + return $this->getInstallerUpgrader($dataUgrader); + } + + /** + * Get the installer or upgrader for a module + * + * @param $path + * @return InstallSchemaInterface| UpgradeSchemaInterface| InstallDataInterface |UpgradeDataInterface | null + */ + private function getInstallerUpgrader($path) + { + if (file_exists($path . '.php')) { + $path = str_replace('/', '\\', str_replace( + $this->directoryList->getPath(DirectoryList::MODULES) . '/' , + '', + $path + )); + return $this->serviceLocator->get($path); + } else { + return null; + } + } +} diff --git a/setup/src/Magento/Setup/Module/SetupFactory.php b/setup/src/Magento/Setup/Module/SetupFactory.php index 2fdab2416a183..636405194c8d9 100644 --- a/setup/src/Magento/Setup/Module/SetupFactory.php +++ b/setup/src/Magento/Setup/Module/SetupFactory.php @@ -17,59 +17,25 @@ class SetupFactory */ private $serviceLocator; - /** - * @var ResourceFactory - */ - private $resourceFactory; - /** * Constructor * * @param ServiceLocatorInterface $serviceLocator - * @param ResourceFactory $resourceFactory */ public function __construct( - ServiceLocatorInterface $serviceLocator, - \Magento\Setup\Module\ResourceFactory $resourceFactory + ServiceLocatorInterface $serviceLocator ) { $this->serviceLocator = $serviceLocator; - $this->resourceFactory = $resourceFactory; } /** * Creates Setup * + * @param \Magento\Framework\App\Resource $resource * @return Setup */ - public function createSetup() - { - return new Setup($this->getResource()); - } - - /** - * Creates SetupModule - * - * @param LoggerInterface $log - * @param string $moduleName - * @return ModuleSchemaResourceInterface - */ - public function createSetupModule(LoggerInterface $log, $moduleName) - { - return new SetupModule( - $log, - $this->serviceLocator->get('Magento\Framework\Module\ModuleList'), - $this->serviceLocator->get('Magento\Setup\Module\Setup\FileResolver'), - $moduleName, - $this->getResource() - ); - } - - private function getResource() + public function createSetup($resource) { - $deploymentConfig = new \Magento\Framework\App\DeploymentConfig( - $this->serviceLocator->get('Magento\Framework\App\DeploymentConfig\Reader'), - [] - ); - return $this->resourceFactory->create($deploymentConfig); + return new Setup($resource); } } From 2a6295ee8a88c0f49596a934864cbef4e8cede24 Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko Date: Tue, 17 Feb 2015 11:13:39 -0600 Subject: [PATCH 037/106] MAGETWO-33884: Changes to database and module.xml - Removed ResourceResolverInterface and ResourceResolver (also code cleanup related to that) - Fixed DbVersionInfo - Updater is not changed because it's going to be changed in scope of MAGETWO-33888 --- app/code/Magento/Core/etc/di.xml | 1 - .../Integrity/Library/_files/blacklist.txt | 1 - .../Test/Legacy/_files/obsolete_classes.php | 2 - .../Framework/Module/DbVersionInfoTest.php | 14 +--- .../Module/Plugin/DbStatusValidatorTest.php | 7 +- .../Framework/Module/ResourceResolverTest.php | 45 ------------- .../Framework/Module/DbVersionInfo.php | 34 +++------- .../Framework/Module/ResourceResolver.php | 65 ------------------- .../Module/ResourceResolverInterface.php | 19 ------ 9 files changed, 12 insertions(+), 176 deletions(-) delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/Module/ResourceResolverTest.php delete mode 100644 lib/internal/Magento/Framework/Module/ResourceResolver.php delete mode 100644 lib/internal/Magento/Framework/Module/ResourceResolverInterface.php diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index 470b2ebb8267b..c3aa64b25e8a0 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -9,7 +9,6 @@ - diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt index 53770b9f92ec4..751601b22de5c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt @@ -57,7 +57,6 @@ lib/internal/Magento/Framework/View/Element/Context.php lib/internal/Magento/Framework/View/Element/Template/Context.php lib/internal/Magento/Framework/View/Element/Redirect.php -lib/internal/Magento/Framework/App/Module/ResourceResolver.php lib/internal/Magento/Framework/Event/Invoker/InvokerDefault.php lib/internal/Magento/Framework/Phrase/Renderer/Translate.php lib/internal/Magento/Framework/Backup/Snapshot.php diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index a08a7cdb9ca32..866cc5207a5b8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -1352,8 +1352,6 @@ ['Magento\Core\Model\Module\Declaration\FileResolver'], ['Magento\Core\Model\Module\Declaration\SchemaLocator'], ['Magento\Core\Model\Module\Dir\ReverseResolver'], - ['Magento\Core\Model\Module\ResourceResolver'], - ['Magento\Core\Model\Module\ResourceResolverInterface'], ['Magento\Core\Model\Resource\SetupInterface'], ['Magento\Core\Model\Db\UpdaterInterface'], ['Magento\Core\Model\Router\NoRouteHandlerInterface'], diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php index f9a23c0d3c2ec..174f1aec8ec7a 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/DbVersionInfoTest.php @@ -23,11 +23,6 @@ class DbVersionInfoTest extends \PHPUnit_Framework_TestCase */ private $moduleResource; - /** - * @var \Magento\Framework\Module\ResourceResolverInterface|\PHPUnit_Framework_MockObject_MockObject - */ - private $resourceResolver; - protected function setUp() { $this->moduleList = $this->getMockForAbstractClass('Magento\Framework\Module\ModuleListInterface'); @@ -44,12 +39,10 @@ protected function setUp() $this->_outputConfig = $this->getMockForAbstractClass('Magento\Framework\Module\Output\ConfigInterface'); $this->moduleResource = $this->getMockForAbstractClass('\Magento\Framework\Module\ResourceInterface'); - $this->resourceResolver = $this->getMockForAbstractClass('\Magento\Framework\Module\ResourceResolverInterface'); $this->dbVersionInfo = new DbVersionInfo( $this->moduleList, - $this->moduleResource, - $this->resourceResolver + $this->moduleResource ); } @@ -129,11 +122,6 @@ public function testGetDbVersionErrors() ->method('getDbVersion') ->will($this->returnValue(2)); - $this->resourceResolver->expects($this->any())->method('getResourceList')->will($this->returnValueMap([ - ['Module_One', ['Module_One']], - ['Module_Two', ['Module_Two']], - ])); - $expectedErrors = [ [ DbVersionInfo::KEY_MODULE => 'Module_One', diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php index 9623727a2c1b9..7ff9a8e28482a 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php @@ -62,12 +62,7 @@ protected function setUp() $moduleList->expects($this->any()) ->method('getNames') ->will($this->returnValue(['Module_One', 'Module_Two'])); - $resourceResolver = $this->getMockForAbstractClass('\Magento\Framework\Module\ResourceResolverInterface'); - $resourceResolver->expects($this->any()) - ->method('getResourceList') - ->will($this->returnCallback(function ($moduleName) { - return ['resource_' . $moduleName]; - })); + $this->moduleManager = $this->getMock('\Magento\Framework\Module\Manager', [], [], '', false); $this->dbVersionInfoMock = $this->getMock('\Magento\Framework\Module\DbVersionInfo', [], [], '', false); $this->_model = new DbStatusValidator( diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/ResourceResolverTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/ResourceResolverTest.php deleted file mode 100644 index 08493918c8237..0000000000000 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/ResourceResolverTest.php +++ /dev/null @@ -1,45 +0,0 @@ -_moduleReaderMock = $this->getMock('Magento\Framework\Module\Dir\Reader', [], [], '', false); - $this->_model = new \Magento\Framework\Module\ResourceResolver($this->_moduleReaderMock); - } - - public function testGetResourceList() - { - $moduleName = 'Module'; - $this->_moduleReaderMock->expects( - $this->any() - )->method( - 'getModuleDir' - )->will( - $this->returnValueMap( - [ - ['data', $moduleName, __DIR__ . '/_files/Module/data'], - ['sql', $moduleName, __DIR__ . '/_files/Module/sql'], - ] - ) - ); - - $expectedResult = ['module_first_setup', 'module_second_setup']; - $this->assertEquals($expectedResult, array_values($this->_model->getResourceList($moduleName))); - } -} diff --git a/lib/internal/Magento/Framework/Module/DbVersionInfo.php b/lib/internal/Magento/Framework/Module/DbVersionInfo.php index 960e5a89a4508..47638a8de9981 100644 --- a/lib/internal/Magento/Framework/Module/DbVersionInfo.php +++ b/lib/internal/Magento/Framework/Module/DbVersionInfo.php @@ -32,31 +32,22 @@ class DbVersionInfo */ private $moduleResource; - /** - * @var ResourceResolverInterface - */ - private $resourceResolver; - /** * @param ModuleListInterface $moduleList * @param ResourceInterface $moduleResource - * @param ResourceResolverInterface $resourceResolver */ public function __construct( ModuleListInterface $moduleList, - ResourceInterface $moduleResource, - ResourceResolverInterface $resourceResolver + ResourceInterface $moduleResource ) { $this->moduleList = $moduleList; $this->moduleResource = $moduleResource; - $this->resourceResolver = $resourceResolver; } /** * Check if DB schema is up to date * * @param string $moduleName - * @param string $resourceName * @return bool */ public function isSchemaUpToDate($moduleName) @@ -67,7 +58,6 @@ public function isSchemaUpToDate($moduleName) /** * @param string $moduleName - * @param string $resourceName * @return bool */ public function isDataUpToDate($moduleName) @@ -86,14 +76,12 @@ public function getDbVersionErrors() { $errors = []; foreach ($this->moduleList->getNames() as $moduleName) { - foreach ($this->resourceResolver->getResourceList($moduleName) as $resourceName) { - if (!$this->isSchemaUpToDate($moduleName)) { - $errors[] = $this->getSchemaInfo($moduleName, $resourceName); - } + if (!$this->isSchemaUpToDate($moduleName)) { + $errors[] = $this->getSchemaInfo($moduleName); + } - if (!$this->isDataUpToDate($moduleName)) { - $errors[] = $this->getDataInfo($moduleName, $resourceName); - } + if (!$this->isDataUpToDate($moduleName)) { + $errors[] = $this->getDataInfo($moduleName); } } return $errors; @@ -103,12 +91,11 @@ public function getDbVersionErrors() * Check if DB schema is up to date, version info if it is not. * * @param string $moduleName - * @param string $resourceName * @return string[] Contains current and needed version strings */ - private function getSchemaInfo($moduleName, $resourceName) + private function getSchemaInfo($moduleName) { - $dbVer = $this->moduleResource->getDbVersion($resourceName); // version saved in DB + $dbVer = $this->moduleResource->getDbVersion($moduleName); // version saved in DB $module = $this->moduleList->getOne($moduleName); $configVer = $module['setup_version']; $dbVer = $dbVer ?: 'none'; @@ -124,12 +111,11 @@ private function getSchemaInfo($moduleName, $resourceName) * Get error data for an out-of-date schema or data. * * @param string $moduleName - * @param string $resourceName * @return string[] */ - private function getDataInfo($moduleName, $resourceName) + private function getDataInfo($moduleName) { - $dataVer = $this->moduleResource->getDataVersion($resourceName); + $dataVer = $this->moduleResource->getDataVersion($moduleName); $module = $this->moduleList->getOne($moduleName); $configVer = $module['setup_version']; $dataVer = $dataVer ?: 'none'; diff --git a/lib/internal/Magento/Framework/Module/ResourceResolver.php b/lib/internal/Magento/Framework/Module/ResourceResolver.php deleted file mode 100644 index b9bfa19ee30ce..0000000000000 --- a/lib/internal/Magento/Framework/Module/ResourceResolver.php +++ /dev/null @@ -1,65 +0,0 @@ -_moduleReader = $moduleReader; - } - - /** - * Retrieve the list of resources declared by the given module - * - * @param string $moduleName - * @return string[] - */ - public function getResourceList($moduleName) - { - if (!isset($this->_moduleResources[$moduleName])) { - // Process sub-directories within modules sql directory - $moduleSqlDir = $this->_moduleReader->getModuleDir('sql', $moduleName); - $sqlResources = []; - $resourceDirs = glob($moduleSqlDir . '/*', GLOB_ONLYDIR); - if (!empty($resourceDirs)) { - foreach ($resourceDirs as $resourceDir) { - $sqlResources[] = basename($resourceDir); - } - } - $moduleDataDir = $this->_moduleReader->getModuleDir('data', $moduleName); - // Process sub-directories within modules data directory - $dataResources = []; - $resourceDirs = glob($moduleDataDir . '/*', GLOB_ONLYDIR); - if (!empty($resourceDirs)) { - foreach ($resourceDirs as $resourceDir) { - $dataResources[] = basename($resourceDir); - } - } - $this->_moduleResources[$moduleName] = array_unique(array_merge($sqlResources, $dataResources)); - } - return $this->_moduleResources[$moduleName]; - } -} diff --git a/lib/internal/Magento/Framework/Module/ResourceResolverInterface.php b/lib/internal/Magento/Framework/Module/ResourceResolverInterface.php deleted file mode 100644 index 9456701d879a0..0000000000000 --- a/lib/internal/Magento/Framework/Module/ResourceResolverInterface.php +++ /dev/null @@ -1,19 +0,0 @@ - Date: Tue, 17 Feb 2015 11:47:02 -0600 Subject: [PATCH 038/106] MAGETWO-33888: Change setup framework to use SPI classes - Few corrections. --- .../Magento/Framework/Module/Updater.php | 60 ++++++++----------- setup/src/Magento/Setup/Module/DataSetup.php | 27 --------- 2 files changed, 25 insertions(+), 62 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/Updater.php b/lib/internal/Magento/Framework/Module/Updater.php index d2b41c3e8cb2e..796365b5c3cfb 100644 --- a/lib/internal/Magento/Framework/Module/Updater.php +++ b/lib/internal/Magento/Framework/Module/Updater.php @@ -8,6 +8,7 @@ namespace Magento\Framework\Module; use Magento\Setup\Module\ModuleInstallerUpgraderFactory; +use Magento\Setup\Module\DataSetup; class Updater { @@ -17,35 +18,27 @@ class Updater protected $_moduleList; /** - * @var ResourceResolverInterface + * @var DbVersionInfo */ - protected $_resourceResolver; + private $_dbVersionInfo; /** - * @var Updater\SetupFactory + * @var DataSetup */ - protected $_setupFactory; + private $setup; /** - * @var DbVersionInfo - */ - private $_dbVersionInfo; - - /** - * @param Updater\SetupFactory $setupFactory + * @param DataSetup $setup * @param ModuleListInterface $moduleList - * @param ResourceResolverInterface $resourceResolver * @param DbVersionInfo $dbVersionInfo */ public function __construct( - Updater\SetupFactory $setupFactory, + DataSetup $setup, ModuleListInterface $moduleList, - ResourceResolverInterface $resourceResolver, DbVersionInfo $dbVersionInfo ) { + $this->setup = $setup; $this->_moduleList = $moduleList; - $this->_resourceResolver = $resourceResolver; - $this->_setupFactory = $setupFactory; $this->_dbVersionInfo = $dbVersionInfo; } @@ -59,29 +52,26 @@ public function __construct( public function updateData($resource, $moduleInstallerUpgraderFactory) { foreach ($this->_moduleList->getNames() as $moduleName) { - foreach ($this->_resourceResolver->getResourceList($moduleName) as $resourceName) { - if (!$this->_dbVersionInfo->isDataUpToDate($moduleName, $resourceName)) { - $moduleDataResource = $this->_setupFactory->create($resourceName, $moduleName); - $dataVer = $resource->getDataVersion($moduleName); - $moduleConfig = $this->_moduleList->getOne($moduleName); - $configVer = $moduleConfig['setup_version']; - $moduleContext = new \Magento\Setup\Model\ModuleContext($dataVer); - if ($dataVer !== false) { - $status = version_compare($configVer, $dataVer); - if ($status == \Magento\Framework\Setup\ModuleDataResourceInterface::VERSION_COMPARE_GREATER) { - $moduleUpgrader = $moduleInstallerUpgraderFactory->createDataUpgrader($moduleName); - if ($moduleUpgrader) { - $moduleUpgrader->upgrade($moduleDataResource, $moduleContext); - $resource->setDataVersion($moduleName, $configVer); - } - } - } elseif ($configVer) { - $moduleInstaller = $moduleInstallerUpgraderFactory->createDataInstaller($moduleName); - if ($moduleInstaller) { - $moduleInstaller->install($moduleDataResource, $moduleContext); + if (!$this->_dbVersionInfo->isDataUpToDate($moduleName)) { + $dataVer = $resource->getDataVersion($moduleName); + $moduleConfig = $this->_moduleList->getOne($moduleName); + $configVer = $moduleConfig['setup_version']; + $moduleContext = new \Magento\Setup\Model\ModuleContext($dataVer); + if ($dataVer !== false) { + $status = version_compare($configVer, $dataVer); + if ($status == \Magento\Framework\Setup\ModuleDataResourceInterface::VERSION_COMPARE_GREATER) { + $moduleUpgrader = $moduleInstallerUpgraderFactory->createDataUpgrader($moduleName); + if ($moduleUpgrader) { + $moduleUpgrader->upgrade($this->setup, $moduleContext); $resource->setDataVersion($moduleName, $configVer); } } + } elseif ($configVer) { + $moduleInstaller = $moduleInstallerUpgraderFactory->createDataInstaller($moduleName); + if ($moduleInstaller) { + $moduleInstaller->install($this->setup, $moduleContext); + $resource->setDataVersion($moduleName, $configVer); + } } } } diff --git a/setup/src/Magento/Setup/Module/DataSetup.php b/setup/src/Magento/Setup/Module/DataSetup.php index 89c1feea6e0c5..013973dbb186d 100644 --- a/setup/src/Magento/Setup/Module/DataSetup.php +++ b/setup/src/Magento/Setup/Module/DataSetup.php @@ -12,25 +12,6 @@ class DataSetup extends \Magento\Framework\Module\Setup implements ModuleDataResourceInterface { - /** - * Setup resource name - * @var string - */ - private $_resourceName; - - /** - * Setup module name - * @var string - */ - private $moduleName; - - /** - * Setup module configuration object - * - * @var array - */ - private $_moduleConfig; - /** * Call afterApplyAllUpdates method flag * @@ -86,26 +67,18 @@ class DataSetup extends \Magento\Framework\Module\Setup implements ModuleDataRes /** * @param \Magento\Framework\Module\Setup\Context $context - * @param string $resourceName - * @param string $moduleName * @param string $connectionName */ public function __construct( \Magento\Framework\Module\Setup\Context $context, - $resourceName, - $moduleName, $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { parent::__construct($context->getResourceModel(), $connectionName); $this->_eventManager = $context->getEventManager(); $this->_logger = $context->getLogger(); $this->_modulesReader = $context->getModulesReader(); - $this->_resourceName = $resourceName; - $this->moduleName = $moduleName; - $this->_resource = $context->getResource(); $this->_migrationFactory = $context->getMigrationFactory(); - $this->_moduleConfig = $context->getModuleList()->getOne($moduleName); $this->filesystem = $context->getFilesystem(); $this->modulesDir = $this->filesystem->getDirectoryRead(DirectoryList::MODULES); } From ff2778e3bd8668eb80ac5bcb499e83604ea87d52 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 17 Feb 2015 11:02:11 -0600 Subject: [PATCH 039/106] MAGETWO-34071: Create Data Install Scripts for Modules with Custom Setup Models - fixed setup cache usage in Eav models - fixed/added tests --- app/code/Magento/Eav/Setup/EavSetup.php | 11 ++- .../Framework/DB/Adapter/InterfaceTest.php | 3 +- .../Magento/Setup/Module/DataSetupTest.php | 5 + .../Php/_files/phpcpd/blacklist/common.txt | 6 -- .../Framework/Module/Setup/MigrationTest.php | 69 ++++--------- .../Magento/Framework/Module/UpdaterTest.php | 4 +- .../Setup/Module/Setup/SetupCacheTest.php | 98 +++++++++++++++++++ .../Magento/Setup/Module/SetupFactoryTest.php | 2 +- .../Magento/Tools/Migration/themes_view.php | 2 +- .../Framework/Module/Setup/Migration.php | 8 +- .../Framework/Setup/DataCacheInterface.php | 65 ++++++++++++ .../Setup/ModuleDataResourceInterface.php | 2 +- setup/src/Magento/Setup/Module/DataSetup.php | 36 +++---- .../Magento/Setup/Module/Setup/SetupCache.php | 75 ++++++++++++++ 14 files changed, 297 insertions(+), 89 deletions(-) create mode 100644 dev/tests/unit/testsuite/Magento/Setup/Module/Setup/SetupCacheTest.php create mode 100644 lib/internal/Magento/Framework/Setup/DataCacheInterface.php create mode 100644 setup/src/Magento/Setup/Module/Setup/SetupCache.php diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php index 1578f24d8c707..435817e59d339 100644 --- a/app/code/Magento/Eav/Setup/EavSetup.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -975,7 +975,8 @@ public function getAttribute($entityTypeId, $id, $field = null) } $mainTable = $this->setup->getTable('eav_attribute'); - if (empty($this->setup->getSetupCache()[$mainTable][$entityTypeId][$id])) { + $setupCache = $this->setup->getSetupCache(); + if (!$setupCache->has($mainTable, $entityTypeId, $id)) { $additionalTable = $this->setup->getTable($additionalTable); $bind = ['id' => $id, 'entity_type_id' => $entityTypeId]; $select = $this->setup->getConnection()->select()->from( @@ -991,14 +992,14 @@ public function getAttribute($entityTypeId, $id, $field = null) $row = $this->setup->getConnection()->fetchRow($select, $bind); if (!$row) { - $this->setup->getSetupCache()[$mainTable][$entityTypeId][$id] = false; + $setupCache->setRow($mainTable, $entityTypeId, $id, false); } else { - $this->setup->getSetupCache()[$mainTable][$entityTypeId][$row['attribute_id']] = $row; - $this->setup->getSetupCache()[$mainTable][$entityTypeId][$row['attribute_code']] = $row; + $setupCache->setRow($mainTable, $entityTypeId, $row['attribute_id'], $row); + $setupCache->setRow($mainTable, $entityTypeId, $row['attribute_code'],$row); } } - $row = $this->setup->getSetupCache()[$mainTable][$entityTypeId][$id]; + $row = $setupCache->get($mainTable, $entityTypeId, $id); if ($field !== null) { return isset($row[$field]) ? $row[$field] : false; } diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php index a7ffaa387a28a..e4c7c19500c5a 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php @@ -33,8 +33,9 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase protected function setUp() { + /** @var \Magento\Framework\Setup\ModuleDataResourceInterface $installer */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Setup\Module\DataSetup', + 'Magento\Framework\Setup\ModuleDataResourceInterface', [ 'resourceName' => 'core_setup', 'moduleName' => 'Magento_Core' diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php index 0bc00c47bc861..afbea4e9acdaf 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php @@ -92,4 +92,9 @@ public function testTableExists() $this->assertTrue($this->_model->tableExists('store_website')); $this->assertFalse($this->_model->tableExists('core/website')); } + + public function testGetSetupCache() + { + $this->assertInstanceOf('Magento\Framework\Setup\DataCacheInterface', $this->_model->getSetupCache()); + } } diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index f27447fc817fb..150a66be8a961 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -148,9 +148,3 @@ Magento/Weee/Model/Resource Magento/Theme/Model/Design/Backend Magento/Core/Model/Resource/Layout/Link Magento/Theme/Model/Resource/Design - -app/code/Magento/Customer/data/customer_setup/data-install-2.0.0.php -app/code/Magento/Customer/Model/Resource/Setup.php -app/code/Magento/Eav/Model/Entity/Setup.php -app/code/Magento/GoogleShopping/data/googleshopping_setup/data-install-2.0.0.php -app/code/Magento/GoogleShopping/Model/Resource/Setup.php diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/Setup/MigrationTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Setup/MigrationTest.php index 05b05da0f75e4..c01165b0aaa1a 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/Setup/MigrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Setup/MigrationTest.php @@ -139,43 +139,13 @@ public function whereCallback($condition) */ public function testAppendClassAliasReplace() { - $moduleListMock = $this->getMock('Magento\Framework\Module\ModuleListInterface'); - $moduleListMock->expects($this->once())->method('getOne')->will($this->returnValue([])); - + $setupMock = $this->getMockForAbstractClass('Magento\Framework\Setup\ModuleDataResourceInterface'); $filesystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); - $modulesDirMock = $this->getMock('Magento\Framework\Filesystem\Directory\Read', [], [], '', false); - $filesystemMock->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($modulesDirMock)); - - $contextMock = $this->getMock('Magento\Framework\Module\Setup\Context', [], [], '', false); - $contextMock->expects($this->any())->method('getFilesystem')->will($this->returnValue($filesystemMock)); - $contextMock->expects($this->once()) - ->method('getEventManager') - ->will( - $this->returnValue( - $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false) - ) - ); - $contextMock->expects($this->once()) - ->method('getResourceModel') - ->will($this->returnValue($this->getMock('Magento\Framework\App\Resource', [], [], '', false))); - $contextMock->expects($this->once()) - ->method('getLogger') - ->will($this->returnValue($this->getMock('Psr\Log\LoggerInterface'))); - $contextMock->expects($this->once()) - ->method('getModulesReader') - ->will( - $this->returnValue( - $this->getMock('Magento\Framework\Module\Dir\Reader', [], [], '', false) - ) - ); - $contextMock->expects($this->once())->method('getModuleList')->will($this->returnValue($moduleListMock)); - $migrationData = $this->getMock('Magento\Framework\Module\Setup\MigrationData', [], [], '', false); $setupModel = new \Magento\Framework\Module\Setup\Migration( - $contextMock, - 'core_setup', - 'Magento_Core', + $setupMock, + $filesystemMock, $migrationData, 'app/etc/aliases_to_classes_map.json' ); @@ -201,6 +171,17 @@ public function testAppendClassAliasReplace() ]; $this->assertAttributeEquals($expectedRulesList, '_replaceRules', $setupModel); + + // Check that replace for the same field is not set twice + $setupModel->appendClassAliasReplace( + 'tableName', + 'fieldName', + 'newEntityType', + 'newFieldContentType', + ['new_pk_field1', 'new_pk_field2'], + 'newAdditionalWhere' + ); + $this->assertAttributeEquals($expectedRulesList, '_replaceRules', $setupModel); } /** @@ -213,26 +194,18 @@ public function testDoUpdateClassAliases($replaceRules, $tableData, $expected, $ $this->_actualUpdateResult = []; $tableRowsCount = count($tableData); + $setupMock = $this->getMockForAbstractClass('Magento\Framework\Setup\ModuleDataResourceInterface'); + $filesystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); + $migrationData = $this->getMock('Magento\Framework\Module\Setup\MigrationData', [], [], '', false); + $setupModel = new \Magento\Framework\Module\Setup\Migration( - $this->getMock('Magento\Framework\App\Resource', [], [], '', false, false), - $this->getMock('Magento\Framework\Filesystem', [], [], '', false), - $this->getMock('Magento\Core\Helper\Data', [], [], '', false), - $this->getMock('Psr\Log\LoggerInterface'), - $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false), - $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'), - $this->getMock('Magento\Framework\Module\ModuleListInterface'), - $this->getMock('Magento\Framework\Module\Dir\Reader', [], [], '', false, false), - $this->getMock('Magento\Framework\Module\Resource', [], [], '', false), - $this->getMock('Magento\Theme\Model\Resource\Theme\CollectionFactory', [], [], '', false), - $this->getMock('Magento\Theme\Model\Theme\CollectionFactory', [], [], '', false), - $this->getMock('Magento\Framework\Module\Setup\MigrationFactory', [], [], '', false), - 'core_setup', + $setupMock, + $filesystemMock, + $migrationData, 'app/etc/aliases_to_classes_map.json', $this->_getModelDependencies($tableRowsCount, $tableData, $aliasesMap) ); - $setupModel->setTable('table', 'table'); - foreach ($replaceRules as $replaceRule) { call_user_func_array([$setupModel, 'appendClassAliasReplace'], $replaceRule); } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php index 2bc27f87e1a2d..4949e56d1e882 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php @@ -23,7 +23,7 @@ class UpdaterTest extends \PHPUnit_Framework_TestCase protected $_moduleListMock; /** - * @var \Magento\Setup\Module\DataSetup|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Setup\ModuleDataResourceInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_resourceSetupMock; @@ -49,7 +49,7 @@ protected function setUp() $this->_moduleListMock = $this->getMock('Magento\Framework\Module\ModuleListInterface'); $this->_resourceResolver = $this->getMock('Magento\Framework\Module\ResourceResolverInterface'); $this->_resourceSetupMock = $this->getMock( - 'Magento\Setup\Module\DataSetup', + 'Magento\Framework\Setup\ModuleDataResourceInterface', [], [], '', diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/Setup/SetupCacheTest.php b/dev/tests/unit/testsuite/Magento/Setup/Module/Setup/SetupCacheTest.php new file mode 100644 index 0000000000000..08b36bffe85cd --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Setup/Module/Setup/SetupCacheTest.php @@ -0,0 +1,98 @@ +object = new SetupCache(); + } + + public function testSetRow() + { + $table = 'table'; + $parentId = 'parent'; + $rowId = 'row'; + $data = new \stdClass(); + + $this->object->setRow($table, $parentId, $rowId, $data); + $this->assertSame($data, $this->object->get($table, $parentId, $rowId)); + } + + public function testSetField() + { + $table = 'table'; + $parentId = 'parent'; + $rowId = 'row'; + $field = 'field'; + $data = new \stdClass(); + + $this->object->setField($table, $parentId, $rowId, $field, $data); + $this->assertSame($data, $this->object->get($table, $parentId, $rowId, $field)); + } + + /** + * @dataProvider getNonexistentDataProvider + * @param string $field + */ + public function testGetNonexistent($field) + { + $this->assertFalse($this->object->get('table', 'parent', 'row', $field)); + } + + /** + * @return array + */ + public function getNonexistentDataProvider() + { + return [ + [null], + ['field'], + ]; + } + + public function testRemove() + { + $table = 'table'; + $parentId = 'parent'; + $rowId = 'row'; + $data = new \stdClass(); + + $this->object->setRow($table, $parentId, $rowId, $data); + $this->object->remove($table, $parentId, $rowId, $data); + $this->assertFalse($this->object->get($table, $parentId, $rowId)); + } + + /** + * @dataProvider hasDataProvider + * @param string $table + * @param string $parentId + * @param string $rowId + * @param string $field + * @param bool $expected + */ + public function testHas($table, $parentId, $rowId, $field, $expected) + { + $this->object->setField('table', 'parent', 'row', 'field', 'data'); + $this->assertSame($expected, $this->object->has($table, $parentId, $rowId, $field)); + } + + public function hasDataProvider() + { + return [ + 'existing' => ['table', 'parent', 'row', 'field', true], + 'nonexistent field' => ['table', 'parent', 'row', 'other_field', false], + 'nonexistent row' => ['table', 'parent', 'other_row', 'field', false], + 'nonexistent parent' => ['table', 'other_parent', 'row', 'field', false], + 'nonexistent table' => ['other_table', 'parent', 'row', 'field', false], + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php b/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php index 4c5ca898699ad..b0e9a2d9d562a 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php @@ -55,6 +55,6 @@ public function testCreateSetupModule() $this->getMockForAbstractClass('Magento\Setup\Model\LoggerInterface'), 'sampleModuleName' ); - $this->assertInstanceOf('Magento\Setup\Module\SetupModule', $setupModule); + $this->assertInstanceOf('Magento\Framework\Setup\ModuleSchemaResourceInterface', $setupModule); } } diff --git a/dev/tools/Magento/Tools/Migration/themes_view.php b/dev/tools/Magento/Tools/Migration/themes_view.php index 883d52be33dc7..c6246d91a63ed 100644 --- a/dev/tools/Magento/Tools/Migration/themes_view.php +++ b/dev/tools/Magento/Tools/Migration/themes_view.php @@ -36,7 +36,7 @@ function updateFieldForTable($objectManager, $table, $col) { /** @var $installer \Magento\Framework\Setup\ModuleDataResourceInterface */ - $installer = $objectManager->create('Magento\Setup\Module\DataSetup'); + $installer = $objectManager->create('Magento\Framework\Setup\ModuleDataResourceInterface'); $installer->startSetup(); $table = $installer->getTable($table); diff --git a/lib/internal/Magento/Framework/Module/Setup/Migration.php b/lib/internal/Magento/Framework/Module/Setup/Migration.php index ebe1f236bd663..a82ff1612f79d 100644 --- a/lib/internal/Magento/Framework/Module/Setup/Migration.php +++ b/lib/internal/Magento/Framework/Module/Setup/Migration.php @@ -7,7 +7,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Filesystem; -use Magento\Setup\Module\DataSetup; +use Magento\Framework\Setup\ModuleDataResourceInterface; /** * Resource setup model with methods needed for migration process between Magento versions @@ -126,19 +126,19 @@ class Migration protected $_migrationData; /** - * @var DataSetup + * @var ModuleDataResourceInterface */ private $setup; /** - * @param DataSetup $setup + * @param ModuleDataResourceInterface $setup * @param Filesystem $filesystem * @param MigrationData $migrationData * @param string $confPathToMapFile * @param array $compositeModules */ public function __construct( - DataSetup $setup, + ModuleDataResourceInterface $setup, Filesystem $filesystem, MigrationData $migrationData, $confPathToMapFile, diff --git a/lib/internal/Magento/Framework/Setup/DataCacheInterface.php b/lib/internal/Magento/Framework/Setup/DataCacheInterface.php new file mode 100644 index 0000000000000..915efbcdbb9b5 --- /dev/null +++ b/lib/internal/Magento/Framework/Setup/DataCacheInterface.php @@ -0,0 +1,65 @@ +_migrationFactory = $context->getMigrationFactory(); $this->filesystem = $context->getFilesystem(); $this->modulesDir = $this->filesystem->getDirectoryRead(DirectoryList::MODULES); + $this->setupCache = new SetupCache(); } /** @@ -88,7 +90,7 @@ public function __construct( */ public function getSetupCache() { - return $this->_setupCache; + return $this->setupCache; } /** @@ -105,7 +107,7 @@ public function getSetupCache() public function getTableRow($table, $idField, $rowId, $field = null, $parentField = null, $parentId = 0) { $table = $this->getTable($table); - if (empty($this->_setupCache[$table][$parentId][$rowId])) { + if (!$this->setupCache->has($table, $parentId, $rowId)) { $adapter = $this->getConnection(); $bind = ['id_field' => $rowId]; $select = $adapter->select()->from($table)->where($adapter->quoteIdentifier($idField) . '= :id_field'); @@ -113,15 +115,10 @@ public function getTableRow($table, $idField, $rowId, $field = null, $parentFiel $select->where($adapter->quoteIdentifier($parentField) . '= :parent_id'); $bind['parent_id'] = $parentId; } - $this->_setupCache[$table][$parentId][$rowId] = $adapter->fetchRow($select, $bind); + $this->setupCache->setRow($table, $parentId, $rowId, $adapter->fetchRow($select, $bind)); } - if (null === $field) { - return $this->_setupCache[$table][$parentId][$rowId]; - } - return isset( - $this->_setupCache[$table][$parentId][$rowId][$field] - ) ? $this->_setupCache[$table][$parentId][$rowId][$field] : false; + return $this->setupCache->get($table, $parentId, $rowId, $field); } /** @@ -145,9 +142,7 @@ public function deleteTableRow($table, $idField, $rowId, $parentField = null, $p $adapter->delete($table, $where); - if (isset($this->_setupCache[$table][$parentId][$rowId])) { - unset($this->_setupCache[$table][$parentId][$rowId]); - } + $this->setupCache->remove($table, $parentId, $rowId); return $this; } @@ -178,15 +173,16 @@ public function updateTableRow($table, $idField, $rowId, $field, $value = null, $where = [$adapter->quoteIdentifier($idField) . '=?' => $rowId]; $adapter->update($table, $data, $where); - if (isset($this->_setupCache[$table][$parentId][$rowId])) { + if ($this->setupCache->has($table, $parentId, $rowId)) { if (is_array($field)) { - $this->_setupCache[$table][$parentId][$rowId] = array_merge( - $this->_setupCache[$table][$parentId][$rowId], + $newRowData = array_merge( + $this->setupCache->get($table, $parentId, $rowId), $field ); } else { - $this->_setupCache[$table][$parentId][$rowId][$field] = $value; + $newRowData = $value; } + $this->setupCache->setRow($table, $parentId, $rowId, $newRowData); } return $this; @@ -205,7 +201,7 @@ public function getCallAfterApplyAllUpdates() /** * Run each time after applying of all updates, - * if setup model setted $_callAfterApplyAllUpdates flag to true + * if setup model set $_callAfterApplyAllUpdates flag to true * * @return $this */ diff --git a/setup/src/Magento/Setup/Module/Setup/SetupCache.php b/setup/src/Magento/Setup/Module/Setup/SetupCache.php new file mode 100644 index 0000000000000..53aa3d6831359 --- /dev/null +++ b/setup/src/Magento/Setup/Module/Setup/SetupCache.php @@ -0,0 +1,75 @@ +data[$table][$parentId][$rowId] = $value; + } + + /** + * {@inheritdoc} + */ + public function setField($table, $parentId, $rowId, $field, $value) + { + $this->data[$table][$parentId][$rowId][$field] = $value; + } + + /** + * {@inheritdoc} + */ + public function get($table, $parentId, $rowId, $field = null) + { + if (null === $field) { + return isset($this->data[$table][$parentId][$rowId]) ? + $this->data[$table][$parentId][$rowId] : + false; + } else { + return isset($this->data[$table][$parentId][$rowId][$field]) ? + $this->data[$table][$parentId][$rowId][$field] : + false; + } + } + + /** + * {@inheritdoc} + */ + public function remove($table, $parentId, $rowId) + { + if (isset($this->data[$table][$parentId][$rowId])) { + unset($this->data[$table][$parentId][$rowId]); + } + } + + /** + * {@inheritdoc} + */ + public function has($table, $parentId, $rowId, $field = null) + { + if (null === $field) { + return isset($this->data[$table][$parentId][$rowId]); + } else { + return isset($this->data[$table][$parentId][$rowId][$field]); + } + } +} From 28f74ef98372739c052e0f642f40d9af9a82f0e7 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 17 Feb 2015 11:31:33 -0600 Subject: [PATCH 040/106] MAGETWO-33887: Create SPI interfaces and context class - fixed code style --- app/code/Magento/Eav/Setup/EavSetup.php | 37 ++++++++++--------- .../Magento/Framework/Module/Setup.php | 26 ++++++------- .../Setup/ModuleDataResourceInterface.php | 2 + 3 files changed, 34 insertions(+), 31 deletions(-) diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php index 435817e59d339..b9c31f6909c62 100644 --- a/app/code/Magento/Eav/Setup/EavSetup.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -30,29 +30,12 @@ class EavSetup * @var PropertyMapperInterface */ private $attributeMapper; + /** * @var ModuleDataResourceInterface */ private $setup; - /** - * @param ModuleDataResourceInterface $setup - * @param Context $context - * @param CacheInterface $cache - * @param CollectionFactory $attrGroupCollectionFactory - */ - public function __construct( - ModuleDataResourceInterface $setup, - Context $context, - CacheInterface $cache, - CollectionFactory $attrGroupCollectionFactory - ) { - $this->cache = $cache; - $this->attrGroupCollectionFactory = $attrGroupCollectionFactory; - $this->attributeMapper = $context->getAttributeMapper(); - $this->setup = $setup; - } - /** * General Attribute Group Name * @@ -81,6 +64,24 @@ public function __construct( */ private $_defaultAttributeSetName = 'Default'; + /** + * @param ModuleDataResourceInterface $setup + * @param Context $context + * @param CacheInterface $cache + * @param CollectionFactory $attrGroupCollectionFactory + */ + public function __construct( + ModuleDataResourceInterface $setup, + Context $context, + CacheInterface $cache, + CollectionFactory $attrGroupCollectionFactory + ) { + $this->cache = $cache; + $this->attrGroupCollectionFactory = $attrGroupCollectionFactory; + $this->attributeMapper = $context->getAttributeMapper(); + $this->setup = $setup; + } + /** * @return ModuleDataResourceInterface */ diff --git a/lib/internal/Magento/Framework/Module/Setup.php b/lib/internal/Magento/Framework/Module/Setup.php index 86ca4f2b24b72..c585c08c17099 100644 --- a/lib/internal/Magento/Framework/Module/Setup.php +++ b/lib/internal/Magento/Framework/Module/Setup.php @@ -17,28 +17,28 @@ class Setup implements ResourceInterface * * @var \Magento\Framework\DB\Adapter\Pdo\Mysql */ - private $_connection = null; + private $connection = null; /** * Tables cache array * * @var array */ - private $_tables = []; + private $tables = []; /** * Modules configuration * * @var \Magento\Framework\App\Resource */ - private $_resourceModel; + private $resourceModel; /** * Connection instance name * * @var string */ - private $_connectionName; + private $connectionName; /** * @param \Magento\Framework\App\Resource $resource @@ -48,8 +48,8 @@ public function __construct( \Magento\Framework\App\Resource $resource, $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION ) { - $this->_resourceModel = $resource; - $this->_connectionName = $connectionName; + $this->resourceModel = $resource; + $this->connectionName = $connectionName; } /** @@ -59,10 +59,10 @@ public function __construct( */ public function getConnection() { - if (null === $this->_connection) { - $this->_connection = $this->_resourceModel->getConnection($this->_connectionName); + if (null === $this->connection) { + $this->connection = $this->resourceModel->getConnection($this->connectionName); } - return $this->_connection; + return $this->connection; } /** @@ -74,7 +74,7 @@ public function getConnection() */ public function setTable($tableName, $realTableName) { - $this->_tables[$tableName] = $realTableName; + $this->tables[$tableName] = $realTableName; return $this; } @@ -87,10 +87,10 @@ public function setTable($tableName, $realTableName) public function getTable($tableName) { $cacheKey = $this->_getTableCacheName($tableName); - if (!isset($this->_tables[$cacheKey])) { - $this->_tables[$cacheKey] = $this->_resourceModel->getTableName($tableName); + if (!isset($this->tables[$cacheKey])) { + $this->tables[$cacheKey] = $this->resourceModel->getTableName($tableName); } - return $this->_tables[$cacheKey]; + return $this->tables[$cacheKey]; } /** diff --git a/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php b/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php index 7bce976772304..62c258f3f8fc8 100644 --- a/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php +++ b/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php @@ -79,6 +79,8 @@ public function getCallAfterApplyAllUpdates(); public function afterApplyAllUpdates(); /** + * Gets event manager + * * @return \Magento\Framework\Event\ManagerInterface */ public function getEventManager(); From df5c9a9a1f2866fec6f645de1d7877f100f093cb Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 17 Feb 2015 11:50:44 -0600 Subject: [PATCH 041/106] MAGETWO-34071: Create Data Install Scripts for Modules with Custom Setup Models - renamed "resource" interfaces to "setup" in order to distinguish with many other "resources" --- .../AdminNotification/Setup/InstallSchema.php | 4 ++-- .../Authorization/Setup/InstallData.php | 4 ++-- .../Authorization/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Bundle/Setup/InstallData.php | 4 ++-- .../Magento/Bundle/Setup/InstallSchema.php | 4 ++-- .../Magento/Captcha/Setup/InstallSchema.php | 4 ++-- .../Magento/Catalog/Setup/CategorySetup.php | 6 +++--- app/code/Magento/Catalog/Setup/InstallData.php | 4 ++-- .../Magento/Catalog/Setup/InstallSchema.php | 4 ++-- .../Magento/Catalog/Setup/UpgradeSchema.php | 4 ++-- .../CatalogInventory/Setup/InstallData.php | 4 ++-- .../CatalogInventory/Setup/InstallSchema.php | 4 ++-- .../Magento/CatalogRule/Setup/InstallData.php | 4 ++-- .../CatalogRule/Setup/InstallSchema.php | 4 ++-- .../CatalogSearch/Setup/InstallSchema.php | 4 ++-- .../CatalogUrlRewrite/Setup/InstallData.php | 4 ++-- .../CatalogUrlRewrite/Setup/InstallSchema.php | 4 ++-- .../Magento/Checkout/Setup/InstallData.php | 4 ++-- .../CheckoutAgreements/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Cms/Setup/InstallData.php | 4 ++-- app/code/Magento/Cms/Setup/InstallSchema.php | 4 ++-- .../ConfigurableProduct/Setup/InstallData.php | 4 ++-- .../Setup/InstallSchema.php | 4 ++-- .../Setup/UpgradeSchema.php | 4 ++-- app/code/Magento/Core/Setup/InstallData.php | 4 ++-- app/code/Magento/Core/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Core/etc/di.xml | 2 +- app/code/Magento/Cron/Setup/InstallSchema.php | 4 ++-- .../Magento/Customer/Setup/CustomerSetup.php | 6 +++--- .../Magento/Customer/Setup/InstallData.php | 4 ++-- .../Magento/Customer/Setup/InstallSchema.php | 4 ++-- .../Magento/Customer/Setup/UpgradeSchema.php | 4 ++-- .../DesignEditor/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Dhl/Setup/InstallData.php | 4 ++-- .../Magento/Directory/Setup/InstallData.php | 4 ++-- .../Magento/Directory/Setup/InstallSchema.php | 4 ++-- .../Magento/Downloadable/Setup/InstallData.php | 4 ++-- .../Downloadable/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Eav/Setup/EavSetup.php | 10 +++++----- app/code/Magento/Eav/Setup/InstallData.php | 4 ++-- app/code/Magento/Eav/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Email/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Fedex/Setup/InstallData.php | 4 ++-- .../Magento/GiftMessage/Setup/InstallData.php | 4 ++-- .../GiftMessage/Setup/InstallSchema.php | 4 ++-- .../GoogleOptimizer/Setup/InstallSchema.php | 4 ++-- .../GoogleShopping/Setup/InstallData.php | 4 ++-- .../GoogleShopping/Setup/InstallSchema.php | 4 ++-- .../GroupedProduct/Setup/InstallData.php | 4 ++-- .../ImportExport/Setup/InstallSchema.php | 4 ++-- .../Magento/Indexer/Setup/InstallSchema.php | 4 ++-- .../Integration/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Log/Setup/InstallData.php | 4 ++-- app/code/Magento/Log/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Msrp/Setup/InstallData.php | 4 ++-- .../Magento/Newsletter/Setup/InstallSchema.php | 4 ++-- .../OfflineShipping/Setup/InstallSchema.php | 4 ++-- .../Magento/Persistent/Setup/InstallSchema.php | 4 ++-- .../ProductAlert/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Quote/Setup/InstallData.php | 4 ++-- app/code/Magento/Quote/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Quote/Setup/QuoteSetup.php | 6 +++--- app/code/Magento/Reports/Setup/InstallData.php | 4 ++-- .../Magento/Reports/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Review/Setup/InstallData.php | 4 ++-- .../Magento/Review/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Sales/Setup/InstallData.php | 4 ++-- app/code/Magento/Sales/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Sales/Setup/SalesSetup.php | 6 +++--- app/code/Magento/Sales/Setup/UpgradeSchema.php | 4 ++-- .../Magento/SalesRule/Setup/InstallData.php | 4 ++-- .../Magento/SalesRule/Setup/InstallSchema.php | 4 ++-- .../Magento/Search/Setup/InstallSchema.php | 4 ++-- .../Magento/Sendfriend/Setup/InstallSchema.php | 4 ++-- .../Magento/Sitemap/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Store/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Tax/Setup/InstallData.php | 4 ++-- app/code/Magento/Tax/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Tax/Setup/TaxSetup.php | 6 +++--- app/code/Magento/Theme/Setup/InstallData.php | 4 ++-- app/code/Magento/Theme/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Theme/Setup/UpgradeSchema.php | 4 ++-- .../Translation/Setup/InstallSchema.php | 4 ++-- .../Magento/UrlRewrite/Setup/InstallSchema.php | 4 ++-- app/code/Magento/User/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Usps/Setup/InstallData.php | 4 ++-- app/code/Magento/Weee/Setup/InstallData.php | 4 ++-- app/code/Magento/Weee/Setup/InstallSchema.php | 4 ++-- app/code/Magento/Weee/Setup/UpgradeSchema.php | 4 ++-- app/code/Magento/Widget/Setup/InstallData.php | 4 ++-- .../Magento/Widget/Setup/InstallSchema.php | 4 ++-- .../Magento/Wishlist/Setup/InstallSchema.php | 4 ++-- .../Framework/DB/Adapter/InterfaceTest.php | 4 ++-- .../Magento/Setup/Module/DataSetupTest.php | 4 ++-- .../Test/Legacy/_files/obsolete_methods.php | 18 +++++++++--------- .../Framework/Module/Setup/MigrationTest.php | 4 ++-- .../Module/Updater/SetupFactoryTest.php | 4 ++-- .../Magento/Framework/Module/UpdaterTest.php | 4 ++-- .../Magento/Setup/Module/SetupFactoryTest.php | 2 +- .../Magento/Tools/Migration/themes_view.php | 4 ++-- .../Magento/Framework/Module/DbVersionInfo.php | 4 ++-- .../Magento/Framework/Module/Setup.php | 8 ++++---- .../Framework/Module/Setup/Migration.php | 8 ++++---- .../Magento/Framework/Module/Updater.php | 2 +- .../Framework/Module/Updater/SetupFactory.php | 6 +++--- .../Framework/Setup/InstallDataInterface.php | 4 ++-- .../Framework/Setup/InstallSchemaInterface.php | 4 ++-- ...erface.php => ModuleDataSetupInterface.php} | 2 +- ...face.php => ModuleSchemaSetupInterface.php} | 2 +- ...eInterface.php => SchemaSetupInterface.php} | 2 +- ...esourceInterface.php => SetupInterface.php} | 2 +- .../Framework/Setup/UpgradeDataInterface.php | 4 ++-- .../Framework/Setup/UpgradeSchemaInterface.php | 4 ++-- setup/src/Magento/Setup/Module/DataSetup.php | 6 +++--- setup/src/Magento/Setup/Module/Setup.php | 4 ++-- .../src/Magento/Setup/Module/SetupFactory.php | 2 +- setup/src/Magento/Setup/Module/SetupModule.php | 8 ++++---- 117 files changed, 249 insertions(+), 249 deletions(-) rename lib/internal/Magento/Framework/Setup/{ModuleDataResourceInterface.php => ModuleDataSetupInterface.php} (97%) rename lib/internal/Magento/Framework/Setup/{ModuleSchemaResourceInterface.php => ModuleSchemaSetupInterface.php} (87%) rename lib/internal/Magento/Framework/Setup/{SchemaResourceInterface.php => SchemaSetupInterface.php} (93%) rename lib/internal/Magento/Framework/Setup/{ResourceInterface.php => SetupInterface.php} (97%) diff --git a/app/code/Magento/AdminNotification/Setup/InstallSchema.php b/app/code/Magento/AdminNotification/Setup/InstallSchema.php index a604913d43d48..7ecba3ea31e06 100644 --- a/app/code/Magento/AdminNotification/Setup/InstallSchema.php +++ b/app/code/Magento/AdminNotification/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Authorization/Setup/InstallData.php b/app/code/Magento/Authorization/Setup/InstallData.php index 5e2e846fb6401..80bf00d9da8f9 100644 --- a/app/code/Magento/Authorization/Setup/InstallData.php +++ b/app/code/Magento/Authorization/Setup/InstallData.php @@ -7,7 +7,7 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Authorization\Model\Acl\Role\Group as RoleGroup; use Magento\Authorization\Model\UserContextInterface; @@ -29,7 +29,7 @@ public function __construct(AuthorizationFactory $authFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $roleCollection = $this->authFactory->createRoleCollection() ->addFieldToFilter('parent_id', 0) diff --git a/app/code/Magento/Authorization/Setup/InstallSchema.php b/app/code/Magento/Authorization/Setup/InstallSchema.php index 0640078758bc6..2c57b529b80f4 100644 --- a/app/code/Magento/Authorization/Setup/InstallSchema.php +++ b/app/code/Magento/Authorization/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Bundle/Setup/InstallData.php b/app/code/Magento/Bundle/Setup/InstallData.php index 4ecb331f5a360..efd1d01b87be2 100644 --- a/app/code/Magento/Bundle/Setup/InstallData.php +++ b/app/code/Magento/Bundle/Setup/InstallData.php @@ -9,7 +9,7 @@ use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -29,7 +29,7 @@ public function __construct(EavSetupFactory $eavSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php index 60691c4c75ac8..b2312ae5f2d1f 100644 --- a/app/code/Magento/Bundle/Setup/InstallSchema.php +++ b/app/code/Magento/Bundle/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Captcha/Setup/InstallSchema.php b/app/code/Magento/Captcha/Setup/InstallSchema.php index 044d67235a011..40a0d009bba14 100644 --- a/app/code/Magento/Captcha/Setup/InstallSchema.php +++ b/app/code/Magento/Captcha/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Catalog/Setup/CategorySetup.php b/app/code/Magento/Catalog/Setup/CategorySetup.php index 1e72337e8fa1c..4a943b4c8e6c3 100644 --- a/app/code/Magento/Catalog/Setup/CategorySetup.php +++ b/app/code/Magento/Catalog/Setup/CategorySetup.php @@ -13,7 +13,7 @@ use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; use Magento\Eav\Setup\EavSetup; use Magento\Framework\App\CacheInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class CategorySetup extends EavSetup { @@ -25,14 +25,14 @@ class CategorySetup extends EavSetup private $categoryFactory; /** - * @param ModuleDataResourceInterface $setup + * @param ModuleDataSetupInterface $setup * @param Context $context * @param CacheInterface $cache * @param CollectionFactory $attrGroupCollectionFactory * @param CategoryFactory $categoryFactory */ public function __construct( - ModuleDataResourceInterface $setup, + ModuleDataSetupInterface $setup, Context $context, CacheInterface $cache, CollectionFactory $attrGroupCollectionFactory, diff --git a/app/code/Magento/Catalog/Setup/InstallData.php b/app/code/Magento/Catalog/Setup/InstallData.php index 8e0591334aba7..4727d7f70e273 100644 --- a/app/code/Magento/Catalog/Setup/InstallData.php +++ b/app/code/Magento/Catalog/Setup/InstallData.php @@ -7,7 +7,7 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -27,7 +27,7 @@ public function __construct(CategorySetupFactory $categorySetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */ $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]); diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php index e324335de184e..01340fa4f67dd 100644 --- a/app/code/Magento/Catalog/Setup/InstallSchema.php +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index 3d6c7b804fa65..465286331e00b 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.0.1') <= 0) { $installer = $setup; diff --git a/app/code/Magento/CatalogInventory/Setup/InstallData.php b/app/code/Magento/CatalogInventory/Setup/InstallData.php index f5886665adb6f..d4b3c1824c014 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallData.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallData.php @@ -9,7 +9,7 @@ use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -29,7 +29,7 @@ public function __construct(EavSetupFactory $eavSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->getConnection() ->insertForce( diff --git a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php index 37e33472991a6..b761d578ab3d8 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/CatalogRule/Setup/InstallData.php b/app/code/Magento/CatalogRule/Setup/InstallData.php index 34354c9e2b2ee..338bee21500ee 100755 --- a/app/code/Magento/CatalogRule/Setup/InstallData.php +++ b/app/code/Magento/CatalogRule/Setup/InstallData.php @@ -11,14 +11,14 @@ use Magento\Framework\Module\Setup\MigrationFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); $setup->startSetup(); diff --git a/app/code/Magento/CatalogRule/Setup/InstallSchema.php b/app/code/Magento/CatalogRule/Setup/InstallSchema.php index 0dd2affd7d73d..f9443b1f1bddd 100644 --- a/app/code/Magento/CatalogRule/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogRule/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php index 169db106f8bc1..bee80d5e6e54b 100644 --- a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php index 63efb0e697fb3..15a7940af8943 100644 --- a/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php @@ -9,7 +9,7 @@ use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -29,7 +29,7 @@ public function __construct(EavSetupFactory $eavSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php index 9fc659cb2b9b4..a4e76f521c4f2 100644 --- a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Checkout/Setup/InstallData.php b/app/code/Magento/Checkout/Setup/InstallData.php index 5ffc247d1c902..81da5284921d5 100644 --- a/app/code/Magento/Checkout/Setup/InstallData.php +++ b/app/code/Magento/Checkout/Setup/InstallData.php @@ -9,7 +9,7 @@ use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -35,7 +35,7 @@ public function __construct(EavSetupFactory $eavSetupFactory, Address $customerA /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var CustomerAddress $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); diff --git a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php index 78d8baa9cb781..86e6ac64fb8a1 100644 --- a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php +++ b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Cms/Setup/InstallData.php b/app/code/Magento/Cms/Setup/InstallData.php index 1c2f4cd90bc81..c1b9d9f5fa061 100644 --- a/app/code/Magento/Cms/Setup/InstallData.php +++ b/app/code/Magento/Cms/Setup/InstallData.php @@ -10,7 +10,7 @@ use Magento\Framework\Module\Setup\Migration; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -30,7 +30,7 @@ public function __construct(PageFactory $pageFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $cmsPages = [ [ diff --git a/app/code/Magento/Cms/Setup/InstallSchema.php b/app/code/Magento/Cms/Setup/InstallSchema.php index f702f28259a3b..18c8cb67d031a 100644 --- a/app/code/Magento/Cms/Setup/InstallSchema.php +++ b/app/code/Magento/Cms/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php index 8c2b4132d56fd..0fe841b60fecf 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php @@ -9,7 +9,7 @@ use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -29,7 +29,7 @@ public function __construct(EavSetupFactory $eavSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php index e5dfce75f707d..945081a1d454d 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php index 2897cf8904db1..d2b18a87201d4 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php +++ b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.1') <= 0) { $installer = $setup; diff --git a/app/code/Magento/Core/Setup/InstallData.php b/app/code/Magento/Core/Setup/InstallData.php index 98f009eba81ff..ecf4fc2323f01 100755 --- a/app/code/Magento/Core/Setup/InstallData.php +++ b/app/code/Magento/Core/Setup/InstallData.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); $setup->startSetup(); diff --git a/app/code/Magento/Core/Setup/InstallSchema.php b/app/code/Magento/Core/Setup/InstallSchema.php index 60132a9756ae9..27446a24d6271 100644 --- a/app/code/Magento/Core/Setup/InstallSchema.php +++ b/app/code/Magento/Core/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index c3aa64b25e8a0..56060c7d28e68 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Cron/Setup/InstallSchema.php b/app/code/Magento/Cron/Setup/InstallSchema.php index caa36fd5fa522..b45529f924243 100644 --- a/app/code/Magento/Cron/Setup/InstallSchema.php +++ b/app/code/Magento/Cron/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Customer/Setup/CustomerSetup.php b/app/code/Magento/Customer/Setup/CustomerSetup.php index b93f5c3968e5d..ed7cdfb463f8e 100644 --- a/app/code/Magento/Customer/Setup/CustomerSetup.php +++ b/app/code/Magento/Customer/Setup/CustomerSetup.php @@ -11,7 +11,7 @@ use Magento\Eav\Model\Entity\Setup\Context; use Magento\Eav\Setup\EavSetup; use Magento\Framework\App\CacheInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; class CustomerSetup extends EavSetup @@ -22,14 +22,14 @@ class CustomerSetup extends EavSetup protected $eavConfig; /** - * @param ModuleDataResourceInterface $setup + * @param ModuleDataSetupInterface $setup * @param Context $context * @param CacheInterface $cache * @param CollectionFactory $attrGroupCollectionFactory * @param Config $eavConfig */ public function __construct( - ModuleDataResourceInterface $setup, + ModuleDataSetupInterface $setup, Context $context, CacheInterface $cache, CollectionFactory $attrGroupCollectionFactory, diff --git a/app/code/Magento/Customer/Setup/InstallData.php b/app/code/Magento/Customer/Setup/InstallData.php index c5ee3c2749d93..1b492828b4436 100644 --- a/app/code/Magento/Customer/Setup/InstallData.php +++ b/app/code/Magento/Customer/Setup/InstallData.php @@ -10,7 +10,7 @@ use Magento\Framework\Module\Setup\Migration; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -30,7 +30,7 @@ public function __construct(CustomerSetupFactory $customerSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var CustomerSetup $customerSetup */ $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]); diff --git a/app/code/Magento/Customer/Setup/InstallSchema.php b/app/code/Magento/Customer/Setup/InstallSchema.php index 12077cd2c31f9..c892fd292fe2e 100644 --- a/app/code/Magento/Customer/Setup/InstallSchema.php +++ b/app/code/Magento/Customer/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Customer/Setup/UpgradeSchema.php b/app/code/Magento/Customer/Setup/UpgradeSchema.php index 0ab1201b72487..08bc8a3f5a1be 100644 --- a/app/code/Magento/Customer/Setup/UpgradeSchema.php +++ b/app/code/Magento/Customer/Setup/UpgradeSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.0.1') <= 0) { $installer = $setup; diff --git a/app/code/Magento/DesignEditor/Setup/InstallSchema.php b/app/code/Magento/DesignEditor/Setup/InstallSchema.php index ac70acabd4da1..e0ea3ce5c3c07 100644 --- a/app/code/Magento/DesignEditor/Setup/InstallSchema.php +++ b/app/code/Magento/DesignEditor/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Dhl/Setup/InstallData.php b/app/code/Magento/Dhl/Setup/InstallData.php index 658b35975bf52..629b57543a65c 100644 --- a/app/code/Magento/Dhl/Setup/InstallData.php +++ b/app/code/Magento/Dhl/Setup/InstallData.php @@ -8,7 +8,7 @@ use Magento\Framework\Locale\ListsInterface; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -28,7 +28,7 @@ public function __construct(ListsInterface $localeLists) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $days = $this->localeLists->getTranslationList('days'); diff --git a/app/code/Magento/Directory/Setup/InstallData.php b/app/code/Magento/Directory/Setup/InstallData.php index a21635c7ee517..165e9c08d8c09 100644 --- a/app/code/Magento/Directory/Setup/InstallData.php +++ b/app/code/Magento/Directory/Setup/InstallData.php @@ -9,7 +9,7 @@ use Magento\Directory\Helper\Data; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -26,7 +26,7 @@ public function __construct(Data $directoryData) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** * Fill table directory/country diff --git a/app/code/Magento/Directory/Setup/InstallSchema.php b/app/code/Magento/Directory/Setup/InstallSchema.php index a7bb92ec593fd..0fe48779e6884 100644 --- a/app/code/Magento/Directory/Setup/InstallSchema.php +++ b/app/code/Magento/Directory/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Downloadable/Setup/InstallData.php b/app/code/Magento/Downloadable/Setup/InstallData.php index 7cf0539a38829..536df8afc1bbd 100644 --- a/app/code/Magento/Downloadable/Setup/InstallData.php +++ b/app/code/Magento/Downloadable/Setup/InstallData.php @@ -9,7 +9,7 @@ use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -29,7 +29,7 @@ public function __construct(EavSetupFactory $eavSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); diff --git a/app/code/Magento/Downloadable/Setup/InstallSchema.php b/app/code/Magento/Downloadable/Setup/InstallSchema.php index b945611f98d8f..525763ab8042b 100644 --- a/app/code/Magento/Downloadable/Setup/InstallSchema.php +++ b/app/code/Magento/Downloadable/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php index b9c31f6909c62..c2027d41cfe29 100644 --- a/app/code/Magento/Eav/Setup/EavSetup.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -9,7 +9,7 @@ use Magento\Eav\Model\Entity\Setup\PropertyMapperInterface; use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; use Magento\Framework\App\CacheInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; /** * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -32,7 +32,7 @@ class EavSetup private $attributeMapper; /** - * @var ModuleDataResourceInterface + * @var ModuleDataSetupInterface */ private $setup; @@ -65,13 +65,13 @@ class EavSetup private $_defaultAttributeSetName = 'Default'; /** - * @param ModuleDataResourceInterface $setup + * @param ModuleDataSetupInterface $setup * @param Context $context * @param CacheInterface $cache * @param CollectionFactory $attrGroupCollectionFactory */ public function __construct( - ModuleDataResourceInterface $setup, + ModuleDataSetupInterface $setup, Context $context, CacheInterface $cache, CollectionFactory $attrGroupCollectionFactory @@ -83,7 +83,7 @@ public function __construct( } /** - * @return ModuleDataResourceInterface + * @return ModuleDataSetupInterface */ public function getSetup() { diff --git a/app/code/Magento/Eav/Setup/InstallData.php b/app/code/Magento/Eav/Setup/InstallData.php index b675d3b9489ea..1150c5cd2f340 100644 --- a/app/code/Magento/Eav/Setup/InstallData.php +++ b/app/code/Magento/Eav/Setup/InstallData.php @@ -8,7 +8,7 @@ use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -28,7 +28,7 @@ public function __construct(EavSetupFactory $eavSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); /** @var \Magento\Framework\Module\Setup\Migration $migrationSetup */ diff --git a/app/code/Magento/Eav/Setup/InstallSchema.php b/app/code/Magento/Eav/Setup/InstallSchema.php index 224a06f6ca36e..5cf809d9ce0fc 100644 --- a/app/code/Magento/Eav/Setup/InstallSchema.php +++ b/app/code/Magento/Eav/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Email/Setup/InstallSchema.php b/app/code/Magento/Email/Setup/InstallSchema.php index c8f2cded44487..f79578c3fd6d2 100644 --- a/app/code/Magento/Email/Setup/InstallSchema.php +++ b/app/code/Magento/Email/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Fedex/Setup/InstallData.php b/app/code/Magento/Fedex/Setup/InstallData.php index ac70e93c4cb60..8b979f44ba427 100755 --- a/app/code/Magento/Fedex/Setup/InstallData.php +++ b/app/code/Magento/Fedex/Setup/InstallData.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $codes = [ 'method' => [ diff --git a/app/code/Magento/GiftMessage/Setup/InstallData.php b/app/code/Magento/GiftMessage/Setup/InstallData.php index 6c01c9ed0853a..01f42ce3e0798 100644 --- a/app/code/Magento/GiftMessage/Setup/InstallData.php +++ b/app/code/Magento/GiftMessage/Setup/InstallData.php @@ -8,7 +8,7 @@ use Magento\Catalog\Setup\CategorySetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Quote\Setup\QuoteSetupFactory; use Magento\Sales\Setup\SalesSetupFactory; @@ -48,7 +48,7 @@ public function __construct( /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** * Add 'gift_message_id' attributes for entities diff --git a/app/code/Magento/GiftMessage/Setup/InstallSchema.php b/app/code/Magento/GiftMessage/Setup/InstallSchema.php index 444c90a388c29..c701c341602bd 100644 --- a/app/code/Magento/GiftMessage/Setup/InstallSchema.php +++ b/app/code/Magento/GiftMessage/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php index ef002e6678ac7..9e93439acedad 100644 --- a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php +++ b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/GoogleShopping/Setup/InstallData.php b/app/code/Magento/GoogleShopping/Setup/InstallData.php index 217f04ec90e36..baa4d0198bc64 100644 --- a/app/code/Magento/GoogleShopping/Setup/InstallData.php +++ b/app/code/Magento/GoogleShopping/Setup/InstallData.php @@ -11,7 +11,7 @@ use Magento\Framework\Module\Manager; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\GoogleShopping\Model\ConfigFactory; class InstallData implements InstallDataInterface @@ -39,7 +39,7 @@ public function __construct(ConfigFactory $configFactory, Manager $moduleManager /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { if ($this->moduleManager->isEnabled('Magento_GoogleBase')) { $typesInsert = $setup->getConnection()->select()->from( diff --git a/app/code/Magento/GoogleShopping/Setup/InstallSchema.php b/app/code/Magento/GoogleShopping/Setup/InstallSchema.php index 1d2d38ebffa14..5e3537508a165 100644 --- a/app/code/Magento/GoogleShopping/Setup/InstallSchema.php +++ b/app/code/Magento/GoogleShopping/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/GroupedProduct/Setup/InstallData.php b/app/code/Magento/GroupedProduct/Setup/InstallData.php index f60daca9b4e2b..16786e43a047b 100644 --- a/app/code/Magento/GroupedProduct/Setup/InstallData.php +++ b/app/code/Magento/GroupedProduct/Setup/InstallData.php @@ -10,7 +10,7 @@ use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -30,7 +30,7 @@ public function __construct(EavSetupFactory $eavSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** * Install grouped product link type diff --git a/app/code/Magento/ImportExport/Setup/InstallSchema.php b/app/code/Magento/ImportExport/Setup/InstallSchema.php index ad0e57b8efeea..beb8086fcfb90 100644 --- a/app/code/Magento/ImportExport/Setup/InstallSchema.php +++ b/app/code/Magento/ImportExport/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Indexer/Setup/InstallSchema.php b/app/code/Magento/Indexer/Setup/InstallSchema.php index dd44f594b6f34..1472bfcd884e6 100644 --- a/app/code/Magento/Indexer/Setup/InstallSchema.php +++ b/app/code/Magento/Indexer/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Integration/Setup/InstallSchema.php b/app/code/Magento/Integration/Setup/InstallSchema.php index a339e6571e9e9..90f4cc4af8706 100644 --- a/app/code/Magento/Integration/Setup/InstallSchema.php +++ b/app/code/Magento/Integration/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Log/Setup/InstallData.php b/app/code/Magento/Log/Setup/InstallData.php index 3ae16d3f0bd9a..53df67b0615a7 100755 --- a/app/code/Magento/Log/Setup/InstallData.php +++ b/app/code/Magento/Log/Setup/InstallData.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Log/Setup/InstallSchema.php b/app/code/Magento/Log/Setup/InstallSchema.php index 6639baf7961fb..bf86e2e058383 100644 --- a/app/code/Magento/Log/Setup/InstallSchema.php +++ b/app/code/Magento/Log/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Msrp/Setup/InstallData.php b/app/code/Magento/Msrp/Setup/InstallData.php index e97d9e767688e..95b4010c4e031 100644 --- a/app/code/Magento/Msrp/Setup/InstallData.php +++ b/app/code/Magento/Msrp/Setup/InstallData.php @@ -9,7 +9,7 @@ use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -29,7 +29,7 @@ public function __construct(EavSetupFactory $eavSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); diff --git a/app/code/Magento/Newsletter/Setup/InstallSchema.php b/app/code/Magento/Newsletter/Setup/InstallSchema.php index 4026beb2cebea..e50e0f5eadc12 100644 --- a/app/code/Magento/Newsletter/Setup/InstallSchema.php +++ b/app/code/Magento/Newsletter/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/OfflineShipping/Setup/InstallSchema.php b/app/code/Magento/OfflineShipping/Setup/InstallSchema.php index 611323f0b736c..df359b2f1db38 100644 --- a/app/code/Magento/OfflineShipping/Setup/InstallSchema.php +++ b/app/code/Magento/OfflineShipping/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Persistent/Setup/InstallSchema.php b/app/code/Magento/Persistent/Setup/InstallSchema.php index ff015684db928..6b4d1dbc2c7e2 100644 --- a/app/code/Magento/Persistent/Setup/InstallSchema.php +++ b/app/code/Magento/Persistent/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/ProductAlert/Setup/InstallSchema.php b/app/code/Magento/ProductAlert/Setup/InstallSchema.php index fa114dabd37fb..9a89b99451f4e 100644 --- a/app/code/Magento/ProductAlert/Setup/InstallSchema.php +++ b/app/code/Magento/ProductAlert/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Quote/Setup/InstallData.php b/app/code/Magento/Quote/Setup/InstallData.php index 9bb7a78b4d607..f4d1684ddda0c 100644 --- a/app/code/Magento/Quote/Setup/InstallData.php +++ b/app/code/Magento/Quote/Setup/InstallData.php @@ -8,7 +8,7 @@ use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -28,7 +28,7 @@ public function __construct(QuoteSetupFactory $setupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var QuoteSetup $quoteSetup */ $quoteSetup = $this->quoteSetupFactory->create(); diff --git a/app/code/Magento/Quote/Setup/InstallSchema.php b/app/code/Magento/Quote/Setup/InstallSchema.php index 04d10e246541c..dfc8e21e8b07a 100644 --- a/app/code/Magento/Quote/Setup/InstallSchema.php +++ b/app/code/Magento/Quote/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Quote/Setup/QuoteSetup.php b/app/code/Magento/Quote/Setup/QuoteSetup.php index 3e4a3fdeab18d..b2bc92afcdcf6 100644 --- a/app/code/Magento/Quote/Setup/QuoteSetup.php +++ b/app/code/Magento/Quote/Setup/QuoteSetup.php @@ -10,7 +10,7 @@ use Magento\Eav\Setup\EavSetup; use Magento\Framework\App\CacheInterface; use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; /** * Setup Model of Quote Module @@ -28,14 +28,14 @@ class QuoteSetup extends EavSetup protected $_encryptor; /** - * @param ModuleDataResourceInterface $setup + * @param ModuleDataSetupInterface $setup * @param Context $context * @param CacheInterface $cache * @param CollectionFactory $attrGroupCollectionFactory * @param ScopeConfigInterface $config */ public function __construct( - ModuleDataResourceInterface $setup, + ModuleDataSetupInterface $setup, Context $context, CacheInterface $cache, CollectionFactory $attrGroupCollectionFactory, diff --git a/app/code/Magento/Reports/Setup/InstallData.php b/app/code/Magento/Reports/Setup/InstallData.php index 0c5b234d5df11..51b3ad7abe7d3 100644 --- a/app/code/Magento/Reports/Setup/InstallData.php +++ b/app/code/Magento/Reports/Setup/InstallData.php @@ -8,7 +8,7 @@ use Magento\Cms\Model\PageFactory; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements \Magento\Framework\Setup\InstallDataInterface { @@ -28,7 +28,7 @@ public function __construct(PageFactory $pageFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); /* diff --git a/app/code/Magento/Reports/Setup/InstallSchema.php b/app/code/Magento/Reports/Setup/InstallSchema.php index 9875c61a51c29..53c3724a6104c 100644 --- a/app/code/Magento/Reports/Setup/InstallSchema.php +++ b/app/code/Magento/Reports/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; /* diff --git a/app/code/Magento/Review/Setup/InstallData.php b/app/code/Magento/Review/Setup/InstallData.php index 35b635ee14de9..0a4f2223d0381 100755 --- a/app/code/Magento/Review/Setup/InstallData.php +++ b/app/code/Magento/Review/Setup/InstallData.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Review/Setup/InstallSchema.php b/app/code/Magento/Review/Setup/InstallSchema.php index 92e3198a71ceb..12c684845ff92 100644 --- a/app/code/Magento/Review/Setup/InstallSchema.php +++ b/app/code/Magento/Review/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Sales/Setup/InstallData.php b/app/code/Magento/Sales/Setup/InstallData.php index 9df310c140d40..4367c781d0a1f 100644 --- a/app/code/Magento/Sales/Setup/InstallData.php +++ b/app/code/Magento/Sales/Setup/InstallData.php @@ -7,7 +7,7 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -27,7 +27,7 @@ public function __construct(SalesSetupFactory $salesSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var \Magento\Sales\Setup\SalesSetup $salesSetup */ $salesSetup = $this->salesSetupFactory->create(); diff --git a/app/code/Magento/Sales/Setup/InstallSchema.php b/app/code/Magento/Sales/Setup/InstallSchema.php index c2989af5bcc6a..28896824845f1 100644 --- a/app/code/Magento/Sales/Setup/InstallSchema.php +++ b/app/code/Magento/Sales/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Sales/Setup/SalesSetup.php b/app/code/Magento/Sales/Setup/SalesSetup.php index 964cb68f1a5db..3bacce6b8e0c8 100644 --- a/app/code/Magento/Sales/Setup/SalesSetup.php +++ b/app/code/Magento/Sales/Setup/SalesSetup.php @@ -10,7 +10,7 @@ use Magento\Framework\App\CacheInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\Encryption\EncryptorInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; /** * Setup Model of Sales Module @@ -28,14 +28,14 @@ class SalesSetup extends \Magento\Eav\Setup\EavSetup protected $encryptor; /** - * @param ModuleDataResourceInterface $setup + * @param ModuleDataSetupInterface $setup * @param Context $context * @param CacheInterface $cache * @param CollectionFactory $attrGroupCollectionFactory * @param ScopeConfigInterface $config */ public function __construct( - ModuleDataResourceInterface $setup, + ModuleDataSetupInterface $setup, Context $context, CacheInterface $cache, CollectionFactory $attrGroupCollectionFactory, diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php index 9b1b8fa1a5b9b..d32e0885d44e3 100644 --- a/app/code/Magento/Sales/Setup/UpgradeSchema.php +++ b/app/code/Magento/Sales/Setup/UpgradeSchema.php @@ -11,14 +11,14 @@ use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.1') <= 0) { diff --git a/app/code/Magento/SalesRule/Setup/InstallData.php b/app/code/Magento/SalesRule/Setup/InstallData.php index 97e65d6e04579..cb85ab8b45ad1 100755 --- a/app/code/Magento/SalesRule/Setup/InstallData.php +++ b/app/code/Magento/SalesRule/Setup/InstallData.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); $setup->startSetup(); diff --git a/app/code/Magento/SalesRule/Setup/InstallSchema.php b/app/code/Magento/SalesRule/Setup/InstallSchema.php index 743d0d425353e..1562022f4a4da 100644 --- a/app/code/Magento/SalesRule/Setup/InstallSchema.php +++ b/app/code/Magento/SalesRule/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Search/Setup/InstallSchema.php b/app/code/Magento/Search/Setup/InstallSchema.php index e5e349c5f31ff..f2d08988a4c73 100644 --- a/app/code/Magento/Search/Setup/InstallSchema.php +++ b/app/code/Magento/Search/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Sendfriend/Setup/InstallSchema.php b/app/code/Magento/Sendfriend/Setup/InstallSchema.php index c46948250cbf1..2b909e2b7d03c 100644 --- a/app/code/Magento/Sendfriend/Setup/InstallSchema.php +++ b/app/code/Magento/Sendfriend/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Sitemap/Setup/InstallSchema.php b/app/code/Magento/Sitemap/Setup/InstallSchema.php index 29c7c8d5cdcb1..fc55374e129bb 100644 --- a/app/code/Magento/Sitemap/Setup/InstallSchema.php +++ b/app/code/Magento/Sitemap/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Store/Setup/InstallSchema.php b/app/code/Magento/Store/Setup/InstallSchema.php index 0d49eb4b4b236..8f0915ce68ec0 100644 --- a/app/code/Magento/Store/Setup/InstallSchema.php +++ b/app/code/Magento/Store/Setup/InstallSchema.php @@ -10,7 +10,7 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; use \Magento\Framework\DB\Ddl\Table; class InstallSchema implements InstallSchemaInterface @@ -18,7 +18,7 @@ class InstallSchema implements InstallSchemaInterface /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Tax/Setup/InstallData.php b/app/code/Magento/Tax/Setup/InstallData.php index c2f1a2f2ed55b..9a604c7c1b206 100644 --- a/app/code/Magento/Tax/Setup/InstallData.php +++ b/app/code/Magento/Tax/Setup/InstallData.php @@ -7,7 +7,7 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -27,7 +27,7 @@ public function __construct(TaxSetupFactory $taxSetupFactory) /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var TaxSetup $taxSetup */ $taxSetup = $this->taxSetupFactory->create(['setup' => $setup]); diff --git a/app/code/Magento/Tax/Setup/InstallSchema.php b/app/code/Magento/Tax/Setup/InstallSchema.php index 020a096c41aa7..1712be7ea99eb 100644 --- a/app/code/Magento/Tax/Setup/InstallSchema.php +++ b/app/code/Magento/Tax/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); diff --git a/app/code/Magento/Tax/Setup/TaxSetup.php b/app/code/Magento/Tax/Setup/TaxSetup.php index f0dbc19c0a059..1c502d4b59e65 100644 --- a/app/code/Magento/Tax/Setup/TaxSetup.php +++ b/app/code/Magento/Tax/Setup/TaxSetup.php @@ -12,7 +12,7 @@ use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; use Magento\Framework\App\CacheInterface; use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Sales\Setup\SalesSetup; /** @@ -31,7 +31,7 @@ class TaxSetup extends SalesSetup protected $productTypeConfig; /** - * @param ModuleDataResourceInterface $setup + * @param ModuleDataSetupInterface $setup * @param Context $context * @param CacheInterface $cache * @param CollectionFactory $attrGroupCollectionFactory @@ -40,7 +40,7 @@ class TaxSetup extends SalesSetup * @param ConfigInterface $productTypeConfig */ public function __construct( - ModuleDataResourceInterface $setup, + ModuleDataSetupInterface $setup, Context $context, CacheInterface $cache, CollectionFactory $attrGroupCollectionFactory, diff --git a/app/code/Magento/Theme/Setup/InstallData.php b/app/code/Magento/Theme/Setup/InstallData.php index 392031fc49312..5eb5fbb2b383c 100644 --- a/app/code/Magento/Theme/Setup/InstallData.php +++ b/app/code/Magento/Theme/Setup/InstallData.php @@ -7,7 +7,7 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { @@ -36,7 +36,7 @@ public function __construct( /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); $setup->startSetup(); diff --git a/app/code/Magento/Theme/Setup/InstallSchema.php b/app/code/Magento/Theme/Setup/InstallSchema.php index 635d0c059ab77..c2fa7460dec0f 100644 --- a/app/code/Magento/Theme/Setup/InstallSchema.php +++ b/app/code/Magento/Theme/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Theme/Setup/UpgradeSchema.php b/app/code/Magento/Theme/Setup/UpgradeSchema.php index 18f4d20d57505..9629c9ff77b35 100644 --- a/app/code/Magento/Theme/Setup/UpgradeSchema.php +++ b/app/code/Magento/Theme/Setup/UpgradeSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.1') <= 0) { $installer = $setup; diff --git a/app/code/Magento/Translation/Setup/InstallSchema.php b/app/code/Magento/Translation/Setup/InstallSchema.php index c402cb98ed263..1c43a32aa42b4 100644 --- a/app/code/Magento/Translation/Setup/InstallSchema.php +++ b/app/code/Magento/Translation/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/UrlRewrite/Setup/InstallSchema.php b/app/code/Magento/UrlRewrite/Setup/InstallSchema.php index 269ae86f46bc7..02d3d818759ae 100644 --- a/app/code/Magento/UrlRewrite/Setup/InstallSchema.php +++ b/app/code/Magento/UrlRewrite/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/User/Setup/InstallSchema.php b/app/code/Magento/User/Setup/InstallSchema.php index 0caa98e152540..d291204ca7514 100644 --- a/app/code/Magento/User/Setup/InstallSchema.php +++ b/app/code/Magento/User/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Usps/Setup/InstallData.php b/app/code/Magento/Usps/Setup/InstallData.php index 35837bdb52adf..9db1c40ba1fa1 100755 --- a/app/code/Magento/Usps/Setup/InstallData.php +++ b/app/code/Magento/Usps/Setup/InstallData.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $configDataTable = $installer->getTable('core_config_data'); diff --git a/app/code/Magento/Weee/Setup/InstallData.php b/app/code/Magento/Weee/Setup/InstallData.php index a3ca65707bdf7..2e0807ba0415a 100644 --- a/app/code/Magento/Weee/Setup/InstallData.php +++ b/app/code/Magento/Weee/Setup/InstallData.php @@ -7,7 +7,7 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Quote\Setup\QuoteSetup; use Magento\Quote\Setup\QuoteSetupFactory; use Magento\Sales\Setup\SalesSetup; @@ -40,7 +40,7 @@ public function __construct( /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var QuoteSetup $quoteSetup */ $quoteSetup = $this->quoteSetupFactory->create(['setup' => $setup]); diff --git a/app/code/Magento/Weee/Setup/InstallSchema.php b/app/code/Magento/Weee/Setup/InstallSchema.php index 7b1cbac4e6a64..191943200cb0b 100644 --- a/app/code/Magento/Weee/Setup/InstallSchema.php +++ b/app/code/Magento/Weee/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); /** diff --git a/app/code/Magento/Weee/Setup/UpgradeSchema.php b/app/code/Magento/Weee/Setup/UpgradeSchema.php index bdf118e1249a7..3c131d78c3d92 100644 --- a/app/code/Magento/Weee/Setup/UpgradeSchema.php +++ b/app/code/Magento/Weee/Setup/UpgradeSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} */ - public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.0.1') <= 0) { $setup->startSetup(); diff --git a/app/code/Magento/Widget/Setup/InstallData.php b/app/code/Magento/Widget/Setup/InstallData.php index c3e86d906852d..114a614019c03 100755 --- a/app/code/Magento/Widget/Setup/InstallData.php +++ b/app/code/Magento/Widget/Setup/InstallData.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { /** * {@inheritdoc} */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); $installer->startSetup(); diff --git a/app/code/Magento/Widget/Setup/InstallSchema.php b/app/code/Magento/Widget/Setup/InstallSchema.php index 942ba028afb69..70f54374cae13 100644 --- a/app/code/Magento/Widget/Setup/InstallSchema.php +++ b/app/code/Magento/Widget/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/app/code/Magento/Wishlist/Setup/InstallSchema.php b/app/code/Magento/Wishlist/Setup/InstallSchema.php index 1b5452569891d..aef56a8cbc7ea 100644 --- a/app/code/Magento/Wishlist/Setup/InstallSchema.php +++ b/app/code/Magento/Wishlist/Setup/InstallSchema.php @@ -10,14 +10,14 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php index e4c7c19500c5a..5e0219f68f0e2 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php @@ -33,9 +33,9 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase protected function setUp() { - /** @var \Magento\Framework\Setup\ModuleDataResourceInterface $installer */ + /** @var \Magento\Framework\Setup\ModuleDataSetupInterface $installer */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Framework\Setup\ModuleDataResourceInterface', + '\Magento\Framework\Setup\ModuleDataSetupInterface', [ 'resourceName' => 'core_setup', 'moduleName' => 'Magento_Core' diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php index afbea4e9acdaf..071ee6f899500 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php @@ -5,12 +5,12 @@ */ namespace Magento\Setup\Module; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class DataSetupTest extends \PHPUnit_Framework_TestCase { /** - * @var ModuleDataResourceInterface + * @var ModuleDataSetupInterface */ protected $_model; diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 30afb364d5c74..fd7215847fa75 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -1939,21 +1939,21 @@ ['_debugStat', 'Magento\Framework\DB\Adapter\Pdo\Mysql', 'Magento\Framework\DB\Logger\File::logStats'], ['_debugException', 'Magento\Framework\DB\Adapter\Pdo\Mysql', 'Magento\Framework\DB\Logger\File::critical'], ['_debugWriteToFile', 'Magento\Framework\DB\Adapter\Pdo\Mysql', 'Magento\Framework\DB\Logger\File::log'], - ['applyDataUpdates', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::applyDataUpdates'], + ['applyDataUpdates', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataSetupInterface::applyDataUpdates'], ['_installData', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_installData'], ['_upgradeData', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_upgradeData'], ['_getAvailableDataFiles', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_getAvailableDataFiles'], ['_modifyResourceDb', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_modifyResourceDb'], ['_includeFile', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_includeFile'], ['_getModifySqlFiles', 'Magento\Framework\Module\Setup', 'Magento\Setup\Module\DataSetup::_getModifySqlFiles'], - ['getTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::getTableRow'], - ['deleteTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::deleteTableRow'], - ['updateTableRow', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::updateTableRow'], - ['getCallAfterApplyAllUpdates', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::getCallAfterApplyAllUpdates'], - ['afterApplyAllUpdates', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataResourceInterface::afterApplyAllUpdates'], - ['getEventManager', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::getEventManager'], - ['getFilesystem', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::getFilesystem'], - ['createMigrationSetup', 'Magento\Framework\Module\Setup', 'Magento\Framework\Setup\ModuleDataResourceInterface::createMigrationSetup'], + ['getTableRow', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataSetupInterface::getTableRow'], + ['deleteTableRow', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataSetupInterface::deleteTableRow'], + ['updateTableRow', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataSetupInterface::updateTableRow'], + ['getCallAfterApplyAllUpdates', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataSetupInterface::getCallAfterApplyAllUpdates'], + ['afterApplyAllUpdates', 'Magento\Framework\Module\Setup', '\\Magento\Framework\Setup\ModuleDataSetupInterface::afterApplyAllUpdates'], + ['getEventManager', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataSetupInterface::getEventManager'], + ['getFilesystem', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataSetupInterface::getFilesystem'], + ['createMigrationSetup', 'Magento\Framework\Module\Setup', '\Magento\Framework\Setup\ModuleDataSetupInterface::createMigrationSetup'], ['getModules', 'Magento\Framework\Module\ModuleList', 'getAll'], ['getModules', 'Magento\Framework\Module\ModuleListInterface', 'getAll'], ['getModule', 'Magento\Framework\Module\ModuleList', 'getOne'], diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/Setup/MigrationTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Setup/MigrationTest.php index c01165b0aaa1a..b79834edf327c 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/Setup/MigrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Setup/MigrationTest.php @@ -139,7 +139,7 @@ public function whereCallback($condition) */ public function testAppendClassAliasReplace() { - $setupMock = $this->getMockForAbstractClass('Magento\Framework\Setup\ModuleDataResourceInterface'); + $setupMock = $this->getMockForAbstractClass('\Magento\Framework\Setup\ModuleDataSetupInterface'); $filesystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); $migrationData = $this->getMock('Magento\Framework\Module\Setup\MigrationData', [], [], '', false); @@ -194,7 +194,7 @@ public function testDoUpdateClassAliases($replaceRules, $tableData, $expected, $ $this->_actualUpdateResult = []; $tableRowsCount = count($tableData); - $setupMock = $this->getMockForAbstractClass('Magento\Framework\Setup\ModuleDataResourceInterface'); + $setupMock = $this->getMockForAbstractClass('\Magento\Framework\Setup\ModuleDataSetupInterface'); $filesystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); $migrationData = $this->getMock('Magento\Framework\Module\Setup\MigrationData', [], [], '', false); diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php index 8e6da7e4d5c1c..47630cf73ba63 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php @@ -27,7 +27,7 @@ public function testCreateUsesDefaultSetupModelClassIfSetupModelIsNotDeclaredFor $moduleName = 'module'; $this->objectManagerMock->expects($this->once())->method('create') ->with( - 'Magento\Framework\Setup\ModuleDataResourceInterface', + '\Magento\Framework\Setup\ModuleDataSetupInterface', [ 'resourceName' => $resourceName, 'moduleName' => $moduleName, @@ -38,7 +38,7 @@ public function testCreateUsesDefaultSetupModelClassIfSetupModelIsNotDeclaredFor /** * @expectedException \LogicException - * @expectedExceptionMessage \Not\Valid\Setup\Model must implement \Magento\Framework\Setup\ModuleDataResourceInterface + * @expectedExceptionMessage \Not\Valid\Setup\Model must implement \\Magento\Framework\Setup\ModuleDataSetupInterface */ public function testCreateThrowsExceptionIfSetupModelIsNotValid() { diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php index 4949e56d1e882..0a26733711966 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php @@ -23,7 +23,7 @@ class UpdaterTest extends \PHPUnit_Framework_TestCase protected $_moduleListMock; /** - * @var \Magento\Framework\Setup\ModuleDataResourceInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Setup\ModuleDataSetupInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_resourceSetupMock; @@ -49,7 +49,7 @@ protected function setUp() $this->_moduleListMock = $this->getMock('Magento\Framework\Module\ModuleListInterface'); $this->_resourceResolver = $this->getMock('Magento\Framework\Module\ResourceResolverInterface'); $this->_resourceSetupMock = $this->getMock( - 'Magento\Framework\Setup\ModuleDataResourceInterface', + '\Magento\Framework\Setup\ModuleDataSetupInterface', [], [], '', diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php b/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php index b0e9a2d9d562a..599f926fd5920 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php @@ -55,6 +55,6 @@ public function testCreateSetupModule() $this->getMockForAbstractClass('Magento\Setup\Model\LoggerInterface'), 'sampleModuleName' ); - $this->assertInstanceOf('Magento\Framework\Setup\ModuleSchemaResourceInterface', $setupModule); + $this->assertInstanceOf('Magento\Framework\Setup\ModuleSchemaSetupInterface', $setupModule); } } diff --git a/dev/tools/Magento/Tools/Migration/themes_view.php b/dev/tools/Magento/Tools/Migration/themes_view.php index c6246d91a63ed..a35394e615399 100644 --- a/dev/tools/Magento/Tools/Migration/themes_view.php +++ b/dev/tools/Magento/Tools/Migration/themes_view.php @@ -35,8 +35,8 @@ */ function updateFieldForTable($objectManager, $table, $col) { - /** @var $installer \Magento\Framework\Setup\ModuleDataResourceInterface */ - $installer = $objectManager->create('Magento\Framework\Setup\ModuleDataResourceInterface'); + /** @var $installer \Magento\Framework\Setup\ModuleDataSetupInterface */ + $installer = $objectManager->create('\Magento\Framework\Setup\ModuleDataSetupInterface'); $installer->startSetup(); $table = $installer->getTable($table); diff --git a/lib/internal/Magento/Framework/Module/DbVersionInfo.php b/lib/internal/Magento/Framework/Module/DbVersionInfo.php index 47638a8de9981..b6dd4519a0164 100644 --- a/lib/internal/Magento/Framework/Module/DbVersionInfo.php +++ b/lib/internal/Magento/Framework/Module/DbVersionInfo.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\Module; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; /** * Class DbVersionInfo @@ -144,6 +144,6 @@ private function isModuleVersionEqual($moduleName, $version) $configVer = $module['setup_version']; return ($version !== false - && version_compare($configVer, $version) === ModuleDataResourceInterface::VERSION_COMPARE_EQUAL); + && version_compare($configVer, $version) === ModuleDataSetupInterface::VERSION_COMPARE_EQUAL); } } diff --git a/lib/internal/Magento/Framework/Module/Setup.php b/lib/internal/Magento/Framework/Module/Setup.php index c585c08c17099..390d7f0d682af 100644 --- a/lib/internal/Magento/Framework/Module/Setup.php +++ b/lib/internal/Magento/Framework/Module/Setup.php @@ -7,10 +7,10 @@ */ namespace Magento\Framework\Module; -use Magento\Framework\Setup\ModuleDataResourceInterface; -use Magento\Framework\Setup\ResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; +use Magento\Framework\Setup\SetupInterface; -class Setup implements ResourceInterface +class Setup implements SetupInterface { /** * Setup Connection @@ -46,7 +46,7 @@ class Setup implements ResourceInterface */ public function __construct( \Magento\Framework\App\Resource $resource, - $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataSetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->resourceModel = $resource; $this->connectionName = $connectionName; diff --git a/lib/internal/Magento/Framework/Module/Setup/Migration.php b/lib/internal/Magento/Framework/Module/Setup/Migration.php index a82ff1612f79d..c0698072e5b31 100644 --- a/lib/internal/Magento/Framework/Module/Setup/Migration.php +++ b/lib/internal/Magento/Framework/Module/Setup/Migration.php @@ -7,7 +7,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Filesystem; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; /** * Resource setup model with methods needed for migration process between Magento versions @@ -126,19 +126,19 @@ class Migration protected $_migrationData; /** - * @var ModuleDataResourceInterface + * @var ModuleDataSetupInterface */ private $setup; /** - * @param ModuleDataResourceInterface $setup + * @param ModuleDataSetupInterface $setup * @param Filesystem $filesystem * @param MigrationData $migrationData * @param string $confPathToMapFile * @param array $compositeModules */ public function __construct( - ModuleDataResourceInterface $setup, + ModuleDataSetupInterface $setup, Filesystem $filesystem, MigrationData $migrationData, $confPathToMapFile, diff --git a/lib/internal/Magento/Framework/Module/Updater.php b/lib/internal/Magento/Framework/Module/Updater.php index 796365b5c3cfb..037a776473810 100644 --- a/lib/internal/Magento/Framework/Module/Updater.php +++ b/lib/internal/Magento/Framework/Module/Updater.php @@ -59,7 +59,7 @@ public function updateData($resource, $moduleInstallerUpgraderFactory) $moduleContext = new \Magento\Setup\Model\ModuleContext($dataVer); if ($dataVer !== false) { $status = version_compare($configVer, $dataVer); - if ($status == \Magento\Framework\Setup\ModuleDataResourceInterface::VERSION_COMPARE_GREATER) { + if ($status == \Magento\Framework\Setup\ModuleDataSetupInterface::VERSION_COMPARE_GREATER) { $moduleUpgrader = $moduleInstallerUpgraderFactory->createDataUpgrader($moduleName); if ($moduleUpgrader) { $moduleUpgrader->upgrade($this->setup, $moduleContext); diff --git a/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php b/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php index f959cec251ef5..200dbccf5bf97 100644 --- a/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php +++ b/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php @@ -8,11 +8,11 @@ namespace Magento\Framework\Module\Updater; use Magento\Framework\ObjectManagerInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; class SetupFactory { - const INSTANCE_TYPE = 'Magento\Framework\Setup\ModuleDataResourceInterface'; + const INSTANCE_TYPE = '\Magento\Framework\Setup\ModuleDataSetupInterface'; /** * @var ObjectManagerInterface @@ -37,7 +37,7 @@ public function __construct(ObjectManagerInterface $objectManager, array $resour /** * @param string $resourceName * @param string $moduleName - * @return ModuleDataResourceInterface + * @return ModuleDataSetupInterface * @throws \LogicException */ public function create($resourceName, $moduleName) diff --git a/lib/internal/Magento/Framework/Setup/InstallDataInterface.php b/lib/internal/Magento/Framework/Setup/InstallDataInterface.php index e591c357df8aa..25020eec54dbc 100644 --- a/lib/internal/Magento/Framework/Setup/InstallDataInterface.php +++ b/lib/internal/Magento/Framework/Setup/InstallDataInterface.php @@ -13,9 +13,9 @@ interface InstallDataInterface /** * Installs data for a module * - * @param ModuleDataResourceInterface $setup + * @param ModuleDataSetupInterface $setup * @param ModuleContextInterface $context * @return void */ - public function install(ModuleDataResourceInterface $setup, ModuleContextInterface $context); + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context); } diff --git a/lib/internal/Magento/Framework/Setup/InstallSchemaInterface.php b/lib/internal/Magento/Framework/Setup/InstallSchemaInterface.php index 291009afcd710..9beb262ed72ab 100644 --- a/lib/internal/Magento/Framework/Setup/InstallSchemaInterface.php +++ b/lib/internal/Magento/Framework/Setup/InstallSchemaInterface.php @@ -13,9 +13,9 @@ interface InstallSchemaInterface /** * Installs DB schema for a module * - * @param SchemaResourceInterface $setup + * @param SchemaSetupInterface $setup * @param ModuleContextInterface $context * @return void */ - public function install(SchemaResourceInterface $setup, ModuleContextInterface $context); + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context); } diff --git a/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php b/lib/internal/Magento/Framework/Setup/ModuleDataSetupInterface.php similarity index 97% rename from lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php rename to lib/internal/Magento/Framework/Setup/ModuleDataSetupInterface.php index 62c258f3f8fc8..01fce5b13aac2 100644 --- a/lib/internal/Magento/Framework/Setup/ModuleDataResourceInterface.php +++ b/lib/internal/Magento/Framework/Setup/ModuleDataSetupInterface.php @@ -8,7 +8,7 @@ /** * DB data resource interface for a module */ -interface ModuleDataResourceInterface extends ResourceInterface +interface ModuleDataSetupInterface extends SetupInterface { const DEFAULT_SETUP_CONNECTION = 'core_setup'; diff --git a/lib/internal/Magento/Framework/Setup/ModuleSchemaResourceInterface.php b/lib/internal/Magento/Framework/Setup/ModuleSchemaSetupInterface.php similarity index 87% rename from lib/internal/Magento/Framework/Setup/ModuleSchemaResourceInterface.php rename to lib/internal/Magento/Framework/Setup/ModuleSchemaSetupInterface.php index 30c97cd01dff5..57bec59145ceb 100644 --- a/lib/internal/Magento/Framework/Setup/ModuleSchemaResourceInterface.php +++ b/lib/internal/Magento/Framework/Setup/ModuleSchemaSetupInterface.php @@ -8,7 +8,7 @@ /** * DB schema resource interface for a module */ -interface ModuleSchemaResourceInterface extends SchemaResourceInterface +interface ModuleSchemaSetupInterface extends SchemaSetupInterface { /** * Applies module recurring post schema updates diff --git a/lib/internal/Magento/Framework/Setup/SchemaResourceInterface.php b/lib/internal/Magento/Framework/Setup/SchemaSetupInterface.php similarity index 93% rename from lib/internal/Magento/Framework/Setup/SchemaResourceInterface.php rename to lib/internal/Magento/Framework/Setup/SchemaSetupInterface.php index b2085e8f084d4..cf8eaa3a9f986 100644 --- a/lib/internal/Magento/Framework/Setup/SchemaResourceInterface.php +++ b/lib/internal/Magento/Framework/Setup/SchemaSetupInterface.php @@ -8,7 +8,7 @@ /** * DB schema resource interface */ -interface SchemaResourceInterface extends ResourceInterface +interface SchemaSetupInterface extends SetupInterface { /** * Retrieves 32bit UNIQUE HASH for a Table index diff --git a/lib/internal/Magento/Framework/Setup/ResourceInterface.php b/lib/internal/Magento/Framework/Setup/SetupInterface.php similarity index 97% rename from lib/internal/Magento/Framework/Setup/ResourceInterface.php rename to lib/internal/Magento/Framework/Setup/SetupInterface.php index e235c7ebc55ec..1274112345d42 100644 --- a/lib/internal/Magento/Framework/Setup/ResourceInterface.php +++ b/lib/internal/Magento/Framework/Setup/SetupInterface.php @@ -8,7 +8,7 @@ /** * DB resource interface */ -interface ResourceInterface +interface SetupInterface { /** * Gets connection object diff --git a/lib/internal/Magento/Framework/Setup/UpgradeDataInterface.php b/lib/internal/Magento/Framework/Setup/UpgradeDataInterface.php index 81b448bac8ea2..052e58b1a0b7f 100644 --- a/lib/internal/Magento/Framework/Setup/UpgradeDataInterface.php +++ b/lib/internal/Magento/Framework/Setup/UpgradeDataInterface.php @@ -13,9 +13,9 @@ interface UpgradeDataInterface /** * Upgrades data for a module * - * @param ModuleDataResourceInterface $setup + * @param ModuleDataSetupInterface $setup * @param ModuleContextInterface $context * @return void */ - public function upgrade(ModuleDataResourceInterface $setup, ModuleContextInterface $context); + public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context); } diff --git a/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php b/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php index 6c968cdd01a3e..88e28cd3c18b9 100644 --- a/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php +++ b/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php @@ -13,9 +13,9 @@ interface UpgradeSchemaInterface /** * Upgrades DB schema for a module * - * @param SchemaResourceInterface $setup + * @param SchemaSetupInterface $setup * @param ModuleContextInterface $context * @return */ - public function upgrade(SchemaResourceInterface $setup, ModuleContextInterface $context); + public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context); } diff --git a/setup/src/Magento/Setup/Module/DataSetup.php b/setup/src/Magento/Setup/Module/DataSetup.php index 832f9408d832e..5bb315598dc05 100644 --- a/setup/src/Magento/Setup/Module/DataSetup.php +++ b/setup/src/Magento/Setup/Module/DataSetup.php @@ -8,10 +8,10 @@ namespace Magento\Setup\Module; use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Setup\Module\Setup\SetupCache; -class DataSetup extends \Magento\Framework\Module\Setup implements ModuleDataResourceInterface +class DataSetup extends \Magento\Framework\Module\Setup implements ModuleDataSetupInterface { /** * Call afterApplyAllUpdates method flag @@ -72,7 +72,7 @@ class DataSetup extends \Magento\Framework\Module\Setup implements ModuleDataRes */ public function __construct( \Magento\Framework\Module\Setup\Context $context, - $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataSetupInterface::DEFAULT_SETUP_CONNECTION ) { parent::__construct($context->getResourceModel(), $connectionName); $this->_eventManager = $context->getEventManager(); diff --git a/setup/src/Magento/Setup/Module/Setup.php b/setup/src/Magento/Setup/Module/Setup.php index b0c304cf1ce15..503ccf92a4e83 100644 --- a/setup/src/Magento/Setup/Module/Setup.php +++ b/setup/src/Magento/Setup/Module/Setup.php @@ -5,9 +5,9 @@ */ namespace Magento\Setup\Module; -use Magento\Framework\Setup\SchemaResourceInterface; +use Magento\Framework\Setup\SchemaSetupInterface; -class Setup extends \Magento\Framework\Module\Setup implements SchemaResourceInterface +class Setup extends \Magento\Framework\Module\Setup implements SchemaSetupInterface { /** * Retrieve 32bit UNIQUE HASH for a Table index diff --git a/setup/src/Magento/Setup/Module/SetupFactory.php b/setup/src/Magento/Setup/Module/SetupFactory.php index 636405194c8d9..1d7f224ce1fb1 100644 --- a/setup/src/Magento/Setup/Module/SetupFactory.php +++ b/setup/src/Magento/Setup/Module/SetupFactory.php @@ -6,7 +6,7 @@ namespace Magento\Setup\Module; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\ModuleSchemaSetupInterface; use Magento\Setup\Model\LoggerInterface; use Zend\ServiceManager\ServiceLocatorInterface; diff --git a/setup/src/Magento/Setup/Module/SetupModule.php b/setup/src/Magento/Setup/Module/SetupModule.php index d3b6d1a408bf5..46a82ec5f8ba6 100644 --- a/setup/src/Magento/Setup/Module/SetupModule.php +++ b/setup/src/Magento/Setup/Module/SetupModule.php @@ -7,12 +7,12 @@ use Magento\Framework\Module\ModuleListInterface; use Magento\Framework\Module\Resource; -use Magento\Framework\Setup\ModuleDataResourceInterface; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; +use Magento\Framework\Setup\ModuleSchemaSetupInterface; use Magento\Setup\Model\LoggerInterface; use Magento\Setup\Module\Setup\FileResolver as SetupFileResolver; -class SetupModule extends Setup implements ModuleSchemaResourceInterface +class SetupModule extends Setup implements ModuleSchemaSetupInterface { const TYPE_DB_INSTALL = 'install'; @@ -74,7 +74,7 @@ public function __construct( SetupFileResolver $fileResolver, $moduleName, \Magento\Framework\App\Resource $resource, - $connectionName = ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION + $connectionName = ModuleDataSetupInterface::DEFAULT_SETUP_CONNECTION ) { parent::__construct($resource, $connectionName); $this->logger = $log; From 45a63e8f9f586ff0589f8158efaa10b31957c89d Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 17 Feb 2015 12:18:02 -0600 Subject: [PATCH 042/106] MAGETWO-34071: Create Data Install Scripts for Modules with Custom Setup Models - updated obsolete classes list --- .../Test/Legacy/_files/obsolete_classes.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 866cc5207a5b8..e8ca31f4dac3d 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -2916,4 +2916,21 @@ ['Magento\Core\Block\RequireCookie', 'Magento\Cookie\Block\RequireCookie'], ['Magento\Core\Controller\Index\NoCookies', 'Magento\Cookie\Controller\Index\NoCookies'], ['Magento\Core\Model\Asset\Config', 'Magento\Framework\View\Asset\Config'], + ['Magento\Framework\Module\DataSetup', 'Magento\Setup\Module\DataSetup'], + ['Magento\Authorization\Model\Resource\Setup', 'Magento\Authorization\Setup\AuthorizationFactory'], + ['Magento\Catalog\Model\Resource\Setup', 'Magento\Catalog\Setup\CategorySetup'], + ['Magento\Checkout\Model\Resource\Setup', 'Magento\Checkout\Setup\InstallData'], + ['Magento\Cms\Model\Resource\Setup', 'Magento\Cms\Setup\InstallData'], + ['Magento\Customer\Model\Resource\Setup', 'Magento\Customer\Setup\CustomerSetup'], + ['Magento\Dhl\Model\Resource\Setup', 'Magento\Dhl\Setup\InstallData'], + ['Magento\Directory\Model\Resource\Setup', 'Magento\Directory\Setup\InstallData'], + ['Magento\Eav\Model\Entity\Setup', 'Magento\Eav\Setup\EavSetup'], + ['Magento\GiftMessage\Model\Resource\Setup', 'Magento\GiftMessage\Setup\InstallData'], + ['Magento\GoogleShopping\Model\Resource\Setup', 'Magento\GoogleShopping\Setup\InstallData'], + ['Magento\Reports\Model\Resource\Setup', 'Magento\Reports\Setup\InstallData'], + ['Magento\Sales\Model\Resource\Setup', 'Magento\Sales\Setup\SalesSetup'], + ['Magento\Tax\Model\Resource\Setup', 'Magento\Tax\Setup\TaxSetup'], + ['Magento\Theme\Model\Resource\Setup', 'Magento\Theme\Setup\InstallData'], + ['Magento\Weee\Model\Resource\Setup', 'Magento\Weee\Setup\InstallData'], + ['Magento\Integration\Model\Resource\Setup', 'Magento\Integration\Model\Manager::processIntegrationConfig()'], ]; From 04e64445bffedb72d1f8bd5a8f2796c5c8beeeb4 Mon Sep 17 00:00:00 2001 From: Safwan Khan Date: Tue, 17 Feb 2015 14:04:01 -0600 Subject: [PATCH 043/106] MAGETWO-33888: Change setup framework to use SPI classes - Reafctored more to work with data update. --- .../Magento/Framework/Module/Updater.php | 35 ++- .../Framework/Module/Updater/SetupFactory.php | 61 ++-- .../Setup/ModuleSchemaResourceInterface.php | 27 -- .../Module/ModuleInstallerUpgraderFactory.php | 32 +- .../Setup/Module/Setup/FileResolver.php | 79 ----- .../src/Magento/Setup/Module/SetupFactory.php | 2 - .../src/Magento/Setup/Module/SetupModule.php | 282 ------------------ 7 files changed, 61 insertions(+), 457 deletions(-) delete mode 100644 lib/internal/Magento/Framework/Setup/ModuleSchemaResourceInterface.php delete mode 100644 setup/src/Magento/Setup/Module/Setup/FileResolver.php delete mode 100644 setup/src/Magento/Setup/Module/SetupModule.php diff --git a/lib/internal/Magento/Framework/Module/Updater.php b/lib/internal/Magento/Framework/Module/Updater.php index 796365b5c3cfb..66b3a6a196d47 100644 --- a/lib/internal/Magento/Framework/Module/Updater.php +++ b/lib/internal/Magento/Framework/Module/Updater.php @@ -12,6 +12,16 @@ class Updater { + /** + * @var Updater\SetupFactory + */ + protected $setupFactory; + + /** + * @var DataSetup + */ + private $dataSetup; + /** * @var ModuleListInterface */ @@ -23,21 +33,19 @@ class Updater private $_dbVersionInfo; /** - * @var DataSetup - */ - private $setup; - - /** - * @param DataSetup $setup + * Updater\SetupFactory $setupFactory + * @param DataSetup $dataSetup * @param ModuleListInterface $moduleList * @param DbVersionInfo $dbVersionInfo */ public function __construct( - DataSetup $setup, + Updater\SetupFactory $setupFactory, + DataSetup $dataSetup, ModuleListInterface $moduleList, DbVersionInfo $dbVersionInfo ) { - $this->setup = $setup; + $this->setupFactory = $setupFactory; + $this->dataSetup = $dataSetup; $this->_moduleList = $moduleList; $this->_dbVersionInfo = $dbVersionInfo; } @@ -46,10 +54,9 @@ public function __construct( * Apply database data updates whenever needed * * @param \Magento\Framework\Module\Resource $resource - * @param ModuleInstallerUpgraderFactory $moduleInstallerUpgraderFactory * @return void */ - public function updateData($resource, $moduleInstallerUpgraderFactory) + public function updateData($resource) { foreach ($this->_moduleList->getNames() as $moduleName) { if (!$this->_dbVersionInfo->isDataUpToDate($moduleName)) { @@ -60,16 +67,16 @@ public function updateData($resource, $moduleInstallerUpgraderFactory) if ($dataVer !== false) { $status = version_compare($configVer, $dataVer); if ($status == \Magento\Framework\Setup\ModuleDataResourceInterface::VERSION_COMPARE_GREATER) { - $moduleUpgrader = $moduleInstallerUpgraderFactory->createDataUpgrader($moduleName); + $moduleUpgrader = $this->setupFactory->create($moduleName, 'upgrade'); if ($moduleUpgrader) { - $moduleUpgrader->upgrade($this->setup, $moduleContext); + $moduleUpgrader->upgrade($this->dataSetup, $moduleContext); $resource->setDataVersion($moduleName, $configVer); } } } elseif ($configVer) { - $moduleInstaller = $moduleInstallerUpgraderFactory->createDataInstaller($moduleName); + $moduleInstaller = $this->setupFactory->create($moduleName, 'install'); if ($moduleInstaller) { - $moduleInstaller->install($this->setup, $moduleContext); + $moduleInstaller->install($this->dataSetup, $moduleContext); $resource->setDataVersion($moduleName, $configVer); } } diff --git a/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php b/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php index f959cec251ef5..ea806bbbb76b3 100644 --- a/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php +++ b/lib/internal/Magento/Framework/Module/Updater/SetupFactory.php @@ -8,51 +8,68 @@ namespace Magento\Framework\Module\Updater; use Magento\Framework\ObjectManagerInterface; -use Magento\Framework\Setup\ModuleDataResourceInterface; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Setup\InstallDataInterface; +use Magento\Framework\Setup\UpgradeDataInterface; class SetupFactory { - const INSTANCE_TYPE = 'Magento\Framework\Setup\ModuleDataResourceInterface'; - /** * @var ObjectManagerInterface */ protected $_objectManager; /** - * @var array + * @var DirectoryList */ - protected $_resourceTypes; + private $directoryList; /** * @param ObjectManagerInterface $objectManager - * @param array $resourceTypes + * @param DirectoryList $directoryList */ - public function __construct(ObjectManagerInterface $objectManager, array $resourceTypes) + public function __construct(ObjectManagerInterface $objectManager, DirectoryList $directoryList) { $this->_objectManager = $objectManager; - $this->_resourceTypes = $resourceTypes; + $this->directoryList = $directoryList; } /** - * @param string $resourceName * @param string $moduleName - * @return ModuleDataResourceInterface - * @throws \LogicException + * @param string $type + * @return InstallDataInterface |UpgradeDataInterface | null */ - public function create($resourceName, $moduleName) + public function create($moduleName, $type) { - $className = isset( - $this->_resourceTypes[$resourceName] - ) ? $this->_resourceTypes[$resourceName] : self::INSTANCE_TYPE; - - if (false == is_subclass_of($className, self::INSTANCE_TYPE) && $className !== self::INSTANCE_TYPE) { - throw new \LogicException($className . ' must implement \\' . self::INSTANCE_TYPE); + $modulePath = str_replace('_', '\\', $moduleName); + if ($type === 'install') { + $dataInstaller = $this->directoryList->getPath(DirectoryList::MODULES) + . '/' . $modulePath . '/Setup/InstallData'; + return $this->getInstallerUpgrader($dataInstaller); + } else { + $dataUgrader = $this->directoryList->getPath(DirectoryList::MODULES) + . '/' . $modulePath . '/Setup/UpgradeData'; + return $this->getInstallerUpgrader($dataUgrader); } + } - return $this->_objectManager->create( - $className, - ['resourceName' => $resourceName, 'moduleName' => $moduleName] - ); + /** + * Get the installer or upgrader for a module + * + * @param $path + * @return InstallDataInterface |UpgradeDataInterface | null + */ + private function getInstallerUpgrader($path) + { + if (file_exists($path . '.php')) { + $path = str_replace('/', '\\', str_replace( + $this->directoryList->getPath(DirectoryList::MODULES) . '/' , + '', + $path + )); + return $this->_objectManager->create($path); + } else { + return null; + } } } diff --git a/lib/internal/Magento/Framework/Setup/ModuleSchemaResourceInterface.php b/lib/internal/Magento/Framework/Setup/ModuleSchemaResourceInterface.php deleted file mode 100644 index 30c97cd01dff5..0000000000000 --- a/lib/internal/Magento/Framework/Setup/ModuleSchemaResourceInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -getInstallerUpgrader($schemaUpgrader); } - /** - * Creates data installer for a module - * - * @param $moduleName - * @return InstallDataInterface | null - */ - public function createDataInstaller($moduleName) - { - $modulePath = str_replace('_', '/', $moduleName); - $dataInstaller = $this->directoryList->getPath(DirectoryList::MODULES) - . '/' . $modulePath . '/Setup/InstallData'; - return $this->getInstallerUpgrader($dataInstaller); - } - - /** - * Creates data upgrader for a module - * - * @param $moduleName - * @return UpgradeDataInterface | null - */ - public function createDataUpgrader($moduleName) - { - $modulePath = str_replace('_', '/', $moduleName); - $dataUgrader = $this->directoryList->getPath(DirectoryList::MODULES) - . '/' . $modulePath . '/Setup/UpgradeData'; - return $this->getInstallerUpgrader($dataUgrader); - } - /** * Get the installer or upgrader for a module * * @param $path - * @return InstallSchemaInterface| UpgradeSchemaInterface| InstallDataInterface |UpgradeDataInterface | null + * @return InstallSchemaInterface| UpgradeSchemaInterface| null */ private function getInstallerUpgrader($path) { diff --git a/setup/src/Magento/Setup/Module/Setup/FileResolver.php b/setup/src/Magento/Setup/Module/Setup/FileResolver.php deleted file mode 100644 index 9c5a47244b499..0000000000000 --- a/setup/src/Magento/Setup/Module/Setup/FileResolver.php +++ /dev/null @@ -1,79 +0,0 @@ -directoryList = $directoryList; - } - - /** - * Get SQL setup files by pattern - * - * @param string $moduleName - * @param string $fileNamePattern - * @return array - */ - public function getSqlSetupFiles($moduleName, $fileNamePattern = '*.php') - { - $modulePath = str_replace('_', '/', $moduleName); - $pattern = $this->directoryList->getPath(DirectoryList::MODULES) - . '/' . $modulePath . '/sql/*/' . $fileNamePattern; - return Glob::glob($pattern, Glob::GLOB_BRACE); - } - - /** - * Get Resource Code by Module Name - * - * @param string $moduleName - * @return string - */ - public function getResourceCode($moduleName) - { - $sqlResources = []; - $dataResources = []; - $modulePath = str_replace('_', '/', $moduleName); - - // Collect files by /app/code/{modulePath}/sql/*/ pattern - $pattern = $this->directoryList->getPath(DirectoryList::MODULES) . '/' . $modulePath . '/sql/*'; - $resourceDirs = Glob::glob($pattern, Glob::GLOB_ONLYDIR); - if (!empty($resourceDirs)) { - foreach ($resourceDirs as $resourceDir) { - $sqlResources[] = basename($resourceDir); - } - } - - // Collect files by /app/code/{modulePath}/data/*/ pattern - $pattern = $this->directoryList->getPath(DirectoryList::MODULES) . '/' . $modulePath . '/data/*'; - $resourceDirs = Glob::glob($pattern, Glob::GLOB_ONLYDIR); - if (!empty($resourceDirs)) { - foreach ($resourceDirs as $resourceDir) { - $dataResources[] = basename($resourceDir); - } - } - - $resources = array_unique(array_merge($sqlResources, $dataResources)); - return array_shift($resources); - } -} diff --git a/setup/src/Magento/Setup/Module/SetupFactory.php b/setup/src/Magento/Setup/Module/SetupFactory.php index 636405194c8d9..d384788095ae2 100644 --- a/setup/src/Magento/Setup/Module/SetupFactory.php +++ b/setup/src/Magento/Setup/Module/SetupFactory.php @@ -6,8 +6,6 @@ namespace Magento\Setup\Module; -use Magento\Framework\Setup\ModuleSchemaResourceInterface; -use Magento\Setup\Model\LoggerInterface; use Zend\ServiceManager\ServiceLocatorInterface; class SetupFactory diff --git a/setup/src/Magento/Setup/Module/SetupModule.php b/setup/src/Magento/Setup/Module/SetupModule.php deleted file mode 100644 index d3b6d1a408bf5..0000000000000 --- a/setup/src/Magento/Setup/Module/SetupModule.php +++ /dev/null @@ -1,282 +0,0 @@ -logger = $log; - $this->fileResolver = $fileResolver; - $this->moduleConfig = $moduleList->getOne($moduleName); - $this->resource = new Resource($resource); - $this->resourceName = $this->fileResolver->getResourceCode($moduleName); - $this->moduleName = $moduleName; - } - - /** - * Apply module recurring post schema updates - * - * @return $this - * @throws \Exception - */ - public function applyRecurringUpdates() - { - $moduleName = (string)$this->moduleConfig['name']; - foreach ($this->fileResolver->getSqlSetupFiles($moduleName, self::TYPE_DB_RECURRING . '.php') as $file) { - try { - $this->includeFile($file); - } catch (\Exception $e) { - throw new \Exception(sprintf('Error in file: "%s" - %s', $file, $e->getMessage()), 0, $e); - } - } - return $this; - } - - /** - * Retrieve available Database install/upgrade files for current module - * - * @param string $actionType - * @param string $fromVersion - * @param string $toVersion - * @return array - */ - private function getAvailableDbFiles($actionType, $fromVersion, $toVersion) - { - $moduleName = (string)$this->moduleConfig['name']; - $dbFiles = []; - $typeFiles = []; - $regExpDb = sprintf('#%s-(.*)\.(php|sql)$#i', $actionType); - $regExpType = sprintf('#%s-%s-(.*)\.(php|sql)$#i', 'mysql4', $actionType); - foreach ($this->fileResolver->getSqlSetupFiles($moduleName, '*.{php,sql}') as $file) { - $matches = []; - if (preg_match($regExpDb, $file, $matches)) { - $dbFiles[$matches[1]] = $file; - } elseif (preg_match($regExpType, $file, $matches)) { - $typeFiles[$matches[1]] = $file; - } - } - - if (empty($typeFiles) && empty($dbFiles)) { - return []; - } - - foreach ($typeFiles as $version => $file) { - $dbFiles[$version] = $file; - } - - return $this->prepareUpgradeFileCollection($actionType, $fromVersion, $toVersion, $dbFiles); - } - - /** - * Apply module resource install, upgrade and data scripts - * - * @return $this - */ - public function applyUpdates() - { - if (!$this->resourceName) { - return $this; - } - $dbVer = $this->resource->getDbVersion($this->moduleName); - $configVer = $this->moduleConfig['setup_version']; - - // Module is installed - if ($dbVer !== false) { - if (version_compare($configVer, $dbVer, '>')) { - $this->applySchemaUpdates(self::TYPE_DB_UPGRADE, $dbVer, $configVer); - $this->resource->setDbVersion($this->moduleName, $configVer); - } - } elseif ($configVer) { - $oldVersion = $this->applySchemaUpdates(self::TYPE_DB_INSTALL, '', $configVer); - $this->applySchemaUpdates(self::TYPE_DB_UPGRADE, $oldVersion, $configVer); - $this->resource->setDbVersion($this->moduleName, $configVer); - } - return $this; - } - - /** - * Run module modification files. Return version of last applied upgrade (false if no upgrades applied) - * @param string $actionType - * @param string $fromVersion - * @param string $toVersion - * @return false|string - * @throws \Exception - */ - private function applySchemaUpdates($actionType, $fromVersion, $toVersion) - { - $files = $this->getAvailableDbFiles($actionType, $fromVersion, $toVersion); - - if (empty($files) || !$this->getConnection()) { - return false; - } - - $version = false; - foreach ($files as $file) { - $fileName = $file['fileName']; - $fileType = pathinfo($fileName, PATHINFO_EXTENSION); - try { - switch ($fileType) { - case 'php': - $result = $this->includeFile($fileName); - break; - default: - $result = false; - break; - } - - if ($result) { - $this->resource->setDbVersion($this->moduleName, $file['toVersion']); - //@todo log - } else { - //@todo log "Failed resource setup: {$fileName}"; - } - } catch (\Exception $e) { - throw new \Exception(sprintf('Error in file: "%s" - %s', $fileName, $e->getMessage()), 0, $e); - } - $version = $file['toVersion']; - } - return $version; - } - - /** - * Get data files for modifications - * - * @param string $actionType - * @param string $fromVersion - * @param string $toVersion - * @param array $arrFiles - * @return array - */ - private function prepareUpgradeFileCollection($actionType, $fromVersion, $toVersion, $arrFiles) - { - $arrRes = []; - switch ($actionType) { - case self::TYPE_DB_INSTALL: - uksort($arrFiles, 'version_compare'); - foreach ($arrFiles as $version => $file) { - if (version_compare($version, $toVersion, '<=')) { - $arrRes[0] = [ - 'toVersion' => $version, - 'fileName' => $file, - ]; - } - } - break; - - case self::TYPE_DB_UPGRADE: - uksort($arrFiles, 'version_compare'); - foreach ($arrFiles as $version => $file) { - $versionInfo = explode('-', $version); - - // In array must be 2 elements: 0 => version from, 1 => version to - if (count($versionInfo) !== 2) { - break; - } - $infoFrom = $versionInfo[0]; - $infoTo = $versionInfo[1]; - if (version_compare($infoFrom, $fromVersion, '>=') - && version_compare($infoTo, $fromVersion, '>') - && version_compare($infoTo, $toVersion, '<=') - && version_compare($infoFrom, $toVersion, '<') - ) { - $arrRes[] = [ - 'toVersion' => $infoTo, - 'fileName' => $file, - ]; - } - } - break; - - default: - break; - } - return $arrRes; - } - - /** - * Include file by path - * This method should perform only file inclusion. - * Implemented to prevent possibility of changing important and used variables - * inside the setup model while installing - * - * @param string $fileName - * @return mixed - */ - private function includeFile($fileName) - { - $this->logger->log("Include {$fileName}"); - return include $fileName; - } -} From 444b4658c93a7a4aafbf1c4dc15345a87df704b0 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 17 Feb 2015 15:43:08 -0600 Subject: [PATCH 044/106] MAGETWO-34071: Create Data Install Scripts for Modules with Custom Setup Models - fixed EAV and other broken installers --- app/code/Magento/Eav/Setup/EavSetup.php | 4 ++-- app/code/Magento/Widget/Setup/InstallData.php | 6 +++--- setup/src/Magento/Setup/Module/DataSetup.php | 13 +++++++++---- setup/src/Magento/Setup/Module/Setup/SetupCache.php | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php index c2027d41cfe29..6d2f5e045a69f 100644 --- a/app/code/Magento/Eav/Setup/EavSetup.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -48,7 +48,7 @@ class EavSetup * * @var array */ - public $defaultGroupIdAssociations = ['General' => 1]; + private $defaultGroupIdAssociations = ['General' => 1]; /** * Default attribute group name @@ -189,7 +189,7 @@ public function addEntityType($code, array $params) } $this->addAttributeSet($code, $this->_defaultAttributeSetName); - $this->addAttributeGroup($code, $defaultGroup, $this->_generalGroupName); + $this->addAttributeGroup($code, $this->_defaultGroupName, $this->_generalGroupName); return $this; } diff --git a/app/code/Magento/Widget/Setup/InstallData.php b/app/code/Magento/Widget/Setup/InstallData.php index 114a614019c03..726cf60a34560 100755 --- a/app/code/Magento/Widget/Setup/InstallData.php +++ b/app/code/Magento/Widget/Setup/InstallData.php @@ -20,7 +20,7 @@ class InstallData implements InstallDataInterface public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); - $installer->startSetup(); + $setup->startSetup(); $installer->appendClassAliasReplace( 'widget_instance', @@ -30,8 +30,8 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface ['instance_id'] ); $installer->doUpdateClassAliases(); - - $installer->endSetup(); + + $setup->endSetup(); } } \ No newline at end of file diff --git a/setup/src/Magento/Setup/Module/DataSetup.php b/setup/src/Magento/Setup/Module/DataSetup.php index 5bb315598dc05..70e5151040db8 100644 --- a/setup/src/Magento/Setup/Module/DataSetup.php +++ b/setup/src/Magento/Setup/Module/DataSetup.php @@ -175,10 +175,15 @@ public function updateTableRow($table, $idField, $rowId, $field, $value = null, if ($this->setupCache->has($table, $parentId, $rowId)) { if (is_array($field)) { - $newRowData = array_merge( - $this->setupCache->get($table, $parentId, $rowId), - $field - ); + $oldRowData = $this->setupCache->get($table, $parentId, $rowId); + if (is_array($oldRowData)) { + $newRowData = array_merge( + $oldRowData, + $field + ); + } else { + $newRowData = $field; + } } else { $newRowData = $value; } diff --git a/setup/src/Magento/Setup/Module/Setup/SetupCache.php b/setup/src/Magento/Setup/Module/Setup/SetupCache.php index 53aa3d6831359..c7c28d21ad980 100644 --- a/setup/src/Magento/Setup/Module/Setup/SetupCache.php +++ b/setup/src/Magento/Setup/Module/Setup/SetupCache.php @@ -67,9 +67,9 @@ public function remove($table, $parentId, $rowId) public function has($table, $parentId, $rowId, $field = null) { if (null === $field) { - return isset($this->data[$table][$parentId][$rowId]); + return !empty($this->data[$table][$parentId][$rowId]); } else { - return isset($this->data[$table][$parentId][$rowId][$field]); + return !empty($this->data[$table][$parentId][$rowId][$field]); } } } From b4f539bcd4f7aa1b7dad2fc6f1950cbc80cb21b9 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 17 Feb 2015 16:03:39 -0600 Subject: [PATCH 045/106] MAGETWO-34071: Create Data Install Scripts for Modules with Custom Setup Models - removed unused installation data --- app/code/Magento/Catalog/Setup/CategorySetup.php | 1 - app/code/Magento/Eav/Setup/EavSetup.php | 6 ------ 2 files changed, 7 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/CategorySetup.php b/app/code/Magento/Catalog/Setup/CategorySetup.php index 4a943b4c8e6c3..3db048cb43983 100644 --- a/app/code/Magento/Catalog/Setup/CategorySetup.php +++ b/app/code/Magento/Catalog/Setup/CategorySetup.php @@ -69,7 +69,6 @@ public function getDefaultEntities() 'table' => 'catalog_category_entity', 'additional_attribute_table' => 'catalog_eav_attribute', 'entity_attribute_collection' => 'Magento\Catalog\Model\Resource\Category\Attribute\Collection', - 'default_group' => 'General Information', 'attributes' => [ 'name' => [ 'type' => 'varchar', diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php index 6d2f5e045a69f..7683c913f8315 100644 --- a/app/code/Magento/Eav/Setup/EavSetup.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -182,12 +182,6 @@ public function addEntityType($code, array $params) $this->setup->getConnection()->insert($this->setup->getTable('eav_entity_type'), $data); } - if (!empty($params['default_group'])) { - $defaultGroup = $params['default_group']; - } else { - $defaultGroup = $this->_defaultGroupName; - } - $this->addAttributeSet($code, $this->_defaultAttributeSetName); $this->addAttributeGroup($code, $this->_defaultGroupName, $this->_generalGroupName); From 8d83b2fed04c8cd8a74144be519868575c6299ff Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 17 Feb 2015 18:36:43 -0600 Subject: [PATCH 046/106] MAGETWO-34071: Create Data Install Scripts for Modules with Custom Setup Models - fixed usage of cache in EAV when removing an attribute - fixed code style --- .../Setup/AuthorizationFactory.php | 5 +- .../Authorization/Setup/InstallData.php | 4 + app/code/Magento/Bundle/Setup/InstallData.php | 11 +- .../Magento/Catalog/Setup/CategorySetup.php | 2 + .../Magento/Catalog/Setup/InstallData.php | 4 + .../CatalogInventory/Setup/InstallData.php | 6 +- .../Magento/CatalogRule/Setup/InstallData.php | 63 +- .../CatalogUrlRewrite/Setup/InstallData.php | 4 + .../Magento/Checkout/Setup/InstallData.php | 10 +- app/code/Magento/Cms/Setup/InstallData.php | 4 + .../ConfigurableProduct/Setup/InstallData.php | 11 +- app/code/Magento/Core/Setup/InstallData.php | 79 +- .../Magento/Customer/Setup/CustomerSetup.php | 9 +- .../Magento/Customer/Setup/InstallData.php | 5 +- .../Magento/Customer/Setup/InstallSchema.php | 2391 +++++++++-------- .../Magento/Customer/Setup/UpgradeSchema.php | 16 +- app/code/Magento/Dhl/Setup/InstallData.php | 4 + .../Magento/Directory/Setup/InstallData.php | 7 + .../Downloadable/Setup/InstallData.php | 9 +- app/code/Magento/Eav/Setup/EavSetup.php | 54 +- app/code/Magento/Eav/Setup/InstallData.php | 4 + app/code/Magento/Fedex/Setup/InstallData.php | 20 +- .../Magento/GiftMessage/Setup/InstallData.php | 8 + .../GoogleShopping/Setup/InstallData.php | 12 +- app/code/Magento/Log/Setup/InstallData.php | 42 +- app/code/Magento/Msrp/Setup/InstallData.php | 4 + app/code/Magento/Quote/Setup/InstallData.php | 4 + .../Magento/Reports/Setup/InstallData.php | 4 + app/code/Magento/Review/Setup/InstallData.php | 126 +- app/code/Magento/Sales/Setup/InstallData.php | 4 + .../Magento/SalesRule/Setup/InstallData.php | 64 +- app/code/Magento/Tax/Setup/InstallData.php | 4 + app/code/Magento/Tax/Setup/TaxSetup.php | 8 + app/code/Magento/Theme/Setup/InstallData.php | 7 +- app/code/Magento/Usps/Setup/InstallData.php | 175 +- app/code/Magento/Weee/Setup/InstallData.php | 6 + app/code/Magento/Widget/Setup/InstallData.php | 46 +- .../Magento/Framework/Module/Setup.php | 2 + .../Framework/Setup/DataCacheInterface.php | 4 +- .../Setup/ModuleDataSetupInterface.php | 6 +- .../Setup/UpgradeSchemaInterface.php | 2 +- .../src/Magento/Setup/Model/ModuleContext.php | 2 + setup/src/Magento/Setup/Module/DataSetup.php | 20 +- .../src/Magento/Setup/Module/SetupFactory.php | 2 + 44 files changed, 1725 insertions(+), 1549 deletions(-) diff --git a/app/code/Magento/Authorization/Setup/AuthorizationFactory.php b/app/code/Magento/Authorization/Setup/AuthorizationFactory.php index 8549c61b751e2..c36aafe9e44f4 100644 --- a/app/code/Magento/Authorization/Setup/AuthorizationFactory.php +++ b/app/code/Magento/Authorization/Setup/AuthorizationFactory.php @@ -7,9 +7,6 @@ /** * Resource Setup Model - * - * @SuppressWarnings(PHPMD.LongVariable) - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class AuthorizationFactory { @@ -42,6 +39,8 @@ class AuthorizationFactory protected $_rulesFactory; /** + * Init + * * @param \Magento\Authorization\Model\Resource\Role\CollectionFactory $roleCollectionFactory * @param \Magento\Authorization\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory * @param \Magento\Authorization\Model\RoleFactory $roleFactory diff --git a/app/code/Magento/Authorization/Setup/InstallData.php b/app/code/Magento/Authorization/Setup/InstallData.php index 80bf00d9da8f9..77ac516f6cded 100644 --- a/app/code/Magento/Authorization/Setup/InstallData.php +++ b/app/code/Magento/Authorization/Setup/InstallData.php @@ -14,11 +14,15 @@ class InstallData implements InstallDataInterface { /** + * Authorization factory + * * @var AuthorizationFactory */ private $authFactory; /** + * Init + * * @param AuthorizationFactory $authFactory */ public function __construct(AuthorizationFactory $authFactory) diff --git a/app/code/Magento/Bundle/Setup/InstallData.php b/app/code/Magento/Bundle/Setup/InstallData.php index efd1d01b87be2..437bce73dd7fe 100644 --- a/app/code/Magento/Bundle/Setup/InstallData.php +++ b/app/code/Magento/Bundle/Setup/InstallData.php @@ -11,14 +11,18 @@ use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; -class InstallData implements InstallDataInterface +class InstallData implements InstallDataInterface { /** + * EAV setup factory + * * @var EavSetupFactory */ private $eavSetupFactory; /** + * Init + * * @param EavSetupFactory $eavSetupFactory */ public function __construct(EavSetupFactory $eavSetupFactory) @@ -45,7 +49,10 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface 'group_price', ]; foreach ($fieldList as $field) { - $applyTo = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')); + $applyTo = explode( + ',', + $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to') + ); if (!in_array('bundle', $applyTo)) { $applyTo[] = 'bundle'; $eavSetup->updateAttribute( diff --git a/app/code/Magento/Catalog/Setup/CategorySetup.php b/app/code/Magento/Catalog/Setup/CategorySetup.php index 3db048cb43983..c79cd205f30d5 100644 --- a/app/code/Magento/Catalog/Setup/CategorySetup.php +++ b/app/code/Magento/Catalog/Setup/CategorySetup.php @@ -25,6 +25,8 @@ class CategorySetup extends EavSetup private $categoryFactory; /** + * Init + * * @param ModuleDataSetupInterface $setup * @param Context $context * @param CacheInterface $cache diff --git a/app/code/Magento/Catalog/Setup/InstallData.php b/app/code/Magento/Catalog/Setup/InstallData.php index 4727d7f70e273..25e7ba07a8b0b 100644 --- a/app/code/Magento/Catalog/Setup/InstallData.php +++ b/app/code/Magento/Catalog/Setup/InstallData.php @@ -12,11 +12,15 @@ class InstallData implements InstallDataInterface { /** + * Category setup factory + * * @var CategorySetupFactory */ private $categorySetupFactory; /** + * Init + * * @param CategorySetupFactory $categorySetupFactory */ public function __construct(CategorySetupFactory $categorySetupFactory) diff --git a/app/code/Magento/CatalogInventory/Setup/InstallData.php b/app/code/Magento/CatalogInventory/Setup/InstallData.php index d4b3c1824c014..81dd4f3a98ecf 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallData.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallData.php @@ -11,14 +11,18 @@ use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; -class InstallData implements InstallDataInterface +class InstallData implements InstallDataInterface { /** + * EAV setup factory + * * @var EavSetupFactory */ private $eavSetupFactory; /** + * Init + * * @param EavSetupFactory $eavSetupFactory */ public function __construct(EavSetupFactory $eavSetupFactory) diff --git a/app/code/Magento/CatalogRule/Setup/InstallData.php b/app/code/Magento/CatalogRule/Setup/InstallData.php index 338bee21500ee..d0ea24a7e3e6d 100755 --- a/app/code/Magento/CatalogRule/Setup/InstallData.php +++ b/app/code/Magento/CatalogRule/Setup/InstallData.php @@ -1,46 +1,43 @@ createMigrationSetup(); - $setup->startSetup(); - - $installer->appendClassAliasReplace( - 'catalogrule', - 'conditions_serialized', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, - ['rule_id'] - ); - $installer->appendClassAliasReplace( - 'catalogrule', - 'actions_serialized', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, - ['rule_id'] - ); - - $installer->doUpdateClassAliases(); + /** + * {@inheritdoc} + */ + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup->createMigrationSetup(); + $setup->startSetup(); + + $installer->appendClassAliasReplace( + 'catalogrule', + 'conditions_serialized', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + ['rule_id'] + ); + $installer->appendClassAliasReplace( + 'catalogrule', + 'actions_serialized', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + ['rule_id'] + ); + + $installer->doUpdateClassAliases(); - $setup->endSetup(); - - } + $setup->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php index 15a7940af8943..aac82dd0b6aa0 100644 --- a/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php @@ -14,11 +14,15 @@ class InstallData implements InstallDataInterface { /** + * EAV setup factory + * * @var EavSetupFactory */ private $eavSetupFactory; /** + * Init + * * @param EavSetupFactory $eavSetupFactory */ public function __construct(EavSetupFactory $eavSetupFactory) diff --git a/app/code/Magento/Checkout/Setup/InstallData.php b/app/code/Magento/Checkout/Setup/InstallData.php index 81da5284921d5..789bc7573270d 100644 --- a/app/code/Magento/Checkout/Setup/InstallData.php +++ b/app/code/Magento/Checkout/Setup/InstallData.php @@ -6,6 +6,7 @@ namespace Magento\Checkout\Setup; use Magento\Customer\Helper\Address; +use Magento\Eav\Setup\EavSetup; use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; @@ -14,15 +15,22 @@ class InstallData implements InstallDataInterface { /** + * EAV setup factory + * * @var EavSetupFactory */ private $eavSetupFactory; + /** + * Customer address + * * @var Address */ private $customerAddress; /** + * Init + * * @param EavSetupFactory $eavSetupFactory * @param Address $customerAddress */ @@ -37,7 +45,7 @@ public function __construct(EavSetupFactory $eavSetupFactory, Address $customerA */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { - /** @var CustomerAddress $eavSetup */ + /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); $setup->startSetup(); diff --git a/app/code/Magento/Cms/Setup/InstallData.php b/app/code/Magento/Cms/Setup/InstallData.php index c1b9d9f5fa061..4da4e6474c82d 100644 --- a/app/code/Magento/Cms/Setup/InstallData.php +++ b/app/code/Magento/Cms/Setup/InstallData.php @@ -15,11 +15,15 @@ class InstallData implements InstallDataInterface { /** + * Page factory + * * @var PageFactory */ private $pageFactory; /** + * Init + * * @param PageFactory $pageFactory */ public function __construct(PageFactory $pageFactory) diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php index 0fe841b60fecf..ad02c12904807 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php @@ -5,20 +5,25 @@ */ namespace Magento\ConfigurableProduct\Setup; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable; use Magento\Eav\Setup\EavSetup; use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; -class InstallData implements InstallDataInterface +class InstallData implements InstallDataInterface { /** + * EAV setup factory + * * @var EavSetupFactory */ private $eavSetupFactory; /** + * Init + * * @param EavSetupFactory $eavSetupFactory */ public function __construct(EavSetupFactory $eavSetupFactory) @@ -51,8 +56,8 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface ',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to') ); - if (!in_array(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE, $relatedProductTypes)) { - $relatedProductTypes[] = \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE; + if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) { + $relatedProductTypes[] = Configurable::TYPE_CODE; $eavSetup->updateAttribute( \Magento\Catalog\Model\Product::ENTITY, $attributeCode, diff --git a/app/code/Magento/Core/Setup/InstallData.php b/app/code/Magento/Core/Setup/InstallData.php index ecf4fc2323f01..706125a47679d 100755 --- a/app/code/Magento/Core/Setup/InstallData.php +++ b/app/code/Magento/Core/Setup/InstallData.php @@ -1,52 +1,51 @@ createMigrationSetup(); - $setup->startSetup(); - - $installer->appendClassAliasReplace( - 'core_config_data', - 'value', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['config_id'] - ); - $installer->appendClassAliasReplace( - 'core_layout_update', - 'xml', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, - ['layout_update_id'] - ); - $installer->doUpdateClassAliases(); - - /** - * Delete rows by condition from authorization_rule - */ - $tableName = $setup->getTable('authorization_rule'); - if ($tableName) { - $setup->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']); - } - - $setup->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup->createMigrationSetup(); + $setup->startSetup(); + + $installer->appendClassAliasReplace( + 'core_config_data', + 'value', + Migration::ENTITY_TYPE_MODEL, + Migration::FIELD_CONTENT_TYPE_PLAIN, + ['config_id'] + ); + $installer->appendClassAliasReplace( + 'core_layout_update', + 'xml', + Migration::ENTITY_TYPE_BLOCK, + Migration::FIELD_CONTENT_TYPE_XML, + ['layout_update_id'] + ); + $installer->doUpdateClassAliases(); + + /** + * Delete rows by condition from authorization_rule + */ + $tableName = $setup->getTable('authorization_rule'); + if ($tableName) { + $setup->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']); + } + + $setup->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Customer/Setup/CustomerSetup.php b/app/code/Magento/Customer/Setup/CustomerSetup.php index ed7cdfb463f8e..047631edd0bb3 100644 --- a/app/code/Magento/Customer/Setup/CustomerSetup.php +++ b/app/code/Magento/Customer/Setup/CustomerSetup.php @@ -17,11 +17,15 @@ class CustomerSetup extends EavSetup { /** + * EAV configuration + * * @var Config */ protected $eavConfig; /** + * Init + * * @param ModuleDataSetupInterface $setup * @param Context $context * @param CacheInterface $cache @@ -104,7 +108,8 @@ public function installCustomerForms() } if ($data) { - $this->getSetup()->getConnection()->insertMultiple($this->getSetup()->getTable('customer_form_attribute'), $data); + $this->getSetup()->getConnection() + ->insertMultiple($this->getSetup()->getTable('customer_form_attribute'), $data); } } @@ -445,6 +450,8 @@ public function getDefaultEntities() } /** + * Gets EAV configuration + * * @return Config */ public function getEavConfig() diff --git a/app/code/Magento/Customer/Setup/InstallData.php b/app/code/Magento/Customer/Setup/InstallData.php index 1b492828b4436..671ac95383081 100644 --- a/app/code/Magento/Customer/Setup/InstallData.php +++ b/app/code/Magento/Customer/Setup/InstallData.php @@ -3,7 +3,6 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile namespace Magento\Customer\Setup; @@ -15,11 +14,15 @@ class InstallData implements InstallDataInterface { /** + * Customer setup factory + * * @var CustomerSetupFactory */ private $customerSetupFactory; /** + * Init + * * @param CustomerSetupFactory $customerSetupFactory */ public function __construct(CustomerSetupFactory $customerSetupFactory) diff --git a/app/code/Magento/Customer/Setup/InstallSchema.php b/app/code/Magento/Customer/Setup/InstallSchema.php index c892fd292fe2e..2b1b5bd5fb85f 100644 --- a/app/code/Magento/Customer/Setup/InstallSchema.php +++ b/app/code/Magento/Customer/Setup/InstallSchema.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Customer\Setup; use Magento\Framework\Setup\InstallSchemaInterface; @@ -14,1186 +12,1211 @@ class InstallSchema implements InstallSchemaInterface { - /** - * {@inheritdoc} - */ - public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) - { - $installer = $setup; - $installer->startSetup(); - - /** - * Create table 'customer_entity' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true], - 'Website Id' - )->addColumn( - 'email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Email' - )->addColumn( - 'group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Group Id' - )->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Store Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Updated At' - )->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Active' - )->addColumn( - 'disable_auto_group_change', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Disable automatic group change based on VAT ID' - )->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', - ['email', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['email', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_entity', ['website_id']), - ['website_id'] - )->addForeignKey( - $installer->getFkName('customer_entity', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Entity' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_address_entity' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - 50, - [], - 'Increment Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true], - 'Parent Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Updated At' - )->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Active' - )->addIndex( - $installer->getIdxName('customer_address_entity', ['parent_id']), - ['parent_id'] - )->addForeignKey( - $installer->getFkName('customer_address_entity', 'parent_id', 'customer_entity', 'entity_id'), - 'parent_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Address Entity' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_address_entity_datetime' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity_datetime') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - ['nullable' => true, 'default' => null], - 'Value' - )->addIndex( - $installer->getIdxName( - 'customer_address_entity_datetime', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] - )->addIndex( - $installer->getIdxName('customer_address_entity_datetime', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] - )->addForeignKey( - $installer->getFkName('customer_address_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_address_entity_datetime', 'entity_id', 'customer_address_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_address_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Address Entity Datetime' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_address_entity_decimal' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity_decimal') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' - )->addIndex( - $installer->getIdxName( - 'customer_address_entity_decimal', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] - )->addIndex( - $installer->getIdxName('customer_address_entity_decimal', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] - )->addForeignKey( - $installer->getFkName('customer_address_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_address_entity_decimal', 'entity_id', 'customer_address_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_address_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Address Entity Decimal' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_address_entity_int' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity_int') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Value' - )->addIndex( - $installer->getIdxName( - 'customer_address_entity_int', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] - )->addIndex( - $installer->getIdxName('customer_address_entity_int', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] - )->addForeignKey( - $installer->getFkName('customer_address_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_address_entity_int', 'entity_id', 'customer_address_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_address_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Address Entity Int' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_address_entity_text' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity_text') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Value' - )->addIndex( - $installer->getIdxName( - 'customer_address_entity_text', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] - )->addForeignKey( - $installer->getFkName('customer_address_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_address_entity_text', 'entity_id', 'customer_address_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_address_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Address Entity Text' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_address_entity_varchar' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_address_entity_varchar') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - )->addIndex( - $installer->getIdxName( - 'customer_address_entity_varchar', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] - )->addIndex( - $installer->getIdxName('customer_address_entity_varchar', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] - )->addForeignKey( - $installer->getFkName('customer_address_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_address_entity_varchar', 'entity_id', 'customer_address_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_address_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Address Entity Varchar' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_entity_datetime' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity_datetime') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - ['nullable' => true, 'default' => null], - 'Value' - )->addIndex( - $installer->getIdxName( - 'customer_entity_datetime', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] - )->addIndex( - $installer->getIdxName('customer_entity_datetime', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] - )->addForeignKey( - $installer->getFkName('customer_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity_datetime', 'entity_id', 'customer_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Entity Datetime' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_entity_decimal' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity_decimal') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' - )->addIndex( - $installer->getIdxName( - 'customer_entity_decimal', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] - )->addIndex( - $installer->getIdxName('customer_entity_decimal', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] - )->addForeignKey( - $installer->getFkName('customer_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity_decimal', 'entity_id', 'customer_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Entity Decimal' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_entity_int' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity_int') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Value' - )->addIndex( - $installer->getIdxName( - 'customer_entity_int', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] - )->addIndex( - $installer->getIdxName('customer_entity_int', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] - )->addForeignKey( - $installer->getFkName('customer_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity_int', 'entity_id', 'customer_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Entity Int' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_entity_text' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity_text') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Value' - )->addIndex( - $installer->getIdxName( - 'customer_entity_text', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] - )->addForeignKey( - $installer->getFkName('customer_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity_text', 'entity_id', 'customer_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Entity Text' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_entity_varchar' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_entity_varchar') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - )->addIndex( - $installer->getIdxName( - 'customer_entity_varchar', - ['entity_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['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'] - )->addIndex( - $installer->getIdxName('customer_entity_varchar', ['entity_id', 'attribute_id', 'value']), - ['entity_id', 'attribute_id', 'value'] - )->addForeignKey( - $installer->getFkName('customer_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity_varchar', 'entity_id', 'customer_entity', 'entity_id'), - 'entity_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Entity Varchar' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_group' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_group') - )->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - )->addColumn( - 'customer_group_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Customer Group Code' - )->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Tax Class Id' - )->setComment( - 'Customer Group' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_eav_attribute' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_eav_attribute') - )->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Id' - )->addColumn( - 'is_visible', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Visible' - )->addColumn( - 'input_filter', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Input Filter' - )->addColumn( - 'multiline_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Multiline Count' - )->addColumn( - 'validate_rules', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Validate Rules' - )->addColumn( - 'is_system', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is System' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - )->addColumn( - 'data_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Data Model' - )->addForeignKey( - $installer->getFkName('customer_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Eav Attribute' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_form_attribute' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_form_attribute') - )->addColumn( - 'form_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Form Code' - )->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Id' - )->addIndex( - $installer->getIdxName('customer_form_attribute', ['attribute_id']), - ['attribute_id'] - )->addForeignKey( - $installer->getFkName('customer_form_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Form Attribute' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_eav_attribute_website' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_eav_attribute_website') - )->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Id' - )->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - )->addColumn( - 'is_visible', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Visible' - )->addColumn( - 'is_required', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Required' - )->addColumn( - 'default_value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Default Value' - )->addColumn( - 'multiline_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Multiline Count' - )->addIndex( - $installer->getIdxName('customer_eav_attribute_website', ['website_id']), - ['website_id'] - )->addForeignKey( - $installer->getFkName('customer_eav_attribute_website', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_eav_attribute_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Customer Eav Attribute Website' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'customer_visitor' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('customer_visitor') - )->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Visitor ID' - )->addColumn( - 'session_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => true, 'default' => null], - 'Session ID' - )->addColumn( - 'last_visit_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Last Visit Time' - )->setComment( - 'Visitor Table' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $installer->startSetup(); + + /** + * Create table 'customer_entity' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true], + 'Website Id' + )->addColumn( + 'email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Email' + )->addColumn( + 'group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Group Id' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Store Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Updated At' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Active' + )->addColumn( + 'disable_auto_group_change', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Disable automatic group change based on VAT ID' + )->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', + ['email', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['email', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('customer_entity', ['website_id']), + ['website_id'] + )->addForeignKey( + $installer->getFkName('customer_entity', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + 50, + [], + 'Increment Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true], + 'Parent Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Updated At' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Active' + )->addIndex( + $installer->getIdxName('customer_address_entity', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('customer_address_entity', 'parent_id', 'customer_entity', 'entity_id'), + 'parent_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity_datetime' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity_datetime') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + ['nullable' => true, 'default' => null], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_address_entity_datetime', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_address_entity_datetime', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_address_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName( + 'customer_address_entity_datetime', + 'entity_id', + 'customer_address_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('customer_address_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity Datetime' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity_decimal' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity_decimal') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_address_entity_decimal', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_address_entity_decimal', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_address_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_address_entity_decimal', 'entity_id', 'customer_address_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_address_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity Decimal' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity_int' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity_int') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_address_entity_int', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_address_entity_int', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_address_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_address_entity_int', 'entity_id', 'customer_address_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_address_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity Int' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity_text' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity_text') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_address_entity_text', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addForeignKey( + $installer->getFkName('customer_address_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_address_entity_text', 'entity_id', 'customer_address_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_address_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity Text' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_address_entity_varchar' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_address_entity_varchar') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_address_entity_varchar', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_address_entity_varchar', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_address_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName( + 'customer_address_entity_varchar', + 'entity_id', + 'customer_address_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('customer_address_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Address Entity Varchar' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_entity_datetime' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity_datetime') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + ['nullable' => true, 'default' => null], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_entity_datetime', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_entity_datetime', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity_datetime', 'entity_id', 'customer_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity Datetime' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_entity_decimal' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity_decimal') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_entity_decimal', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_entity_decimal', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity_decimal', 'entity_id', 'customer_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity Decimal' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_entity_int' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity_int') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_entity_int', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_entity_int', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity_int', 'entity_id', 'customer_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity Int' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_entity_text' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity_text') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_entity_text', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addForeignKey( + $installer->getFkName('customer_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity_text', 'entity_id', 'customer_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity Text' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_entity_varchar' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_entity_varchar') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + )->addIndex( + $installer->getIdxName( + 'customer_entity_varchar', + ['entity_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['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'] + )->addIndex( + $installer->getIdxName('customer_entity_varchar', ['entity_id', 'attribute_id', 'value']), + ['entity_id', 'attribute_id', 'value'] + )->addForeignKey( + $installer->getFkName('customer_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_entity_varchar', 'entity_id', 'customer_entity', 'entity_id'), + 'entity_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Entity Varchar' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_group' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_group') + )->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + )->addColumn( + 'customer_group_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Customer Group Code' + )->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Tax Class Id' + )->setComment( + 'Customer Group' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_eav_attribute' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_eav_attribute') + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Id' + )->addColumn( + 'is_visible', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Visible' + )->addColumn( + 'input_filter', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Input Filter' + )->addColumn( + 'multiline_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Multiline Count' + )->addColumn( + 'validate_rules', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Validate Rules' + )->addColumn( + 'is_system', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is System' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + )->addColumn( + 'data_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Data Model' + )->addForeignKey( + $installer->getFkName('customer_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Eav Attribute' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_form_attribute' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_form_attribute') + )->addColumn( + 'form_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Form Code' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Id' + )->addIndex( + $installer->getIdxName('customer_form_attribute', ['attribute_id']), + ['attribute_id'] + )->addForeignKey( + $installer->getFkName('customer_form_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Form Attribute' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_eav_attribute_website' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_eav_attribute_website') + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Id' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + )->addColumn( + 'is_visible', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Visible' + )->addColumn( + 'is_required', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Required' + )->addColumn( + 'default_value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Default Value' + )->addColumn( + 'multiline_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Multiline Count' + )->addIndex( + $installer->getIdxName('customer_eav_attribute_website', ['website_id']), + ['website_id'] + )->addForeignKey( + $installer->getFkName('customer_eav_attribute_website', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('customer_eav_attribute_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Customer Eav Attribute Website' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'customer_visitor' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('customer_visitor') + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Visitor ID' + )->addColumn( + 'session_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => true, 'default' => null], + 'Session ID' + )->addColumn( + 'last_visit_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Last Visit Time' + )->setComment( + 'Visitor Table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Customer/Setup/UpgradeSchema.php b/app/code/Magento/Customer/Setup/UpgradeSchema.php index 08bc8a3f5a1be..d70a46738543c 100644 --- a/app/code/Magento/Customer/Setup/UpgradeSchema.php +++ b/app/code/Magento/Customer/Setup/UpgradeSchema.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Customer\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; @@ -14,11 +12,11 @@ class UpgradeSchema implements UpgradeSchemaInterface { - /** - * {@inheritdoc} - */ - public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) - { + /** + * {@inheritdoc} + */ + public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) + { if (version_compare($context->getVersion(), '2.0.0.1') <= 0) { $installer = $setup; $installer->startSetup(); @@ -58,5 +56,5 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $connection->dropColumn($installer->getTable('customer_entity'), 'attribute_set_id'); $installer->endSetup(); } - } -} \ No newline at end of file + } +} diff --git a/app/code/Magento/Dhl/Setup/InstallData.php b/app/code/Magento/Dhl/Setup/InstallData.php index 629b57543a65c..4917a3f8ae8c5 100644 --- a/app/code/Magento/Dhl/Setup/InstallData.php +++ b/app/code/Magento/Dhl/Setup/InstallData.php @@ -13,11 +13,15 @@ class InstallData implements InstallDataInterface { /** + * Locale list + * * @var ListsInterface */ private $localeLists; /** + * Init + * * @param ListsInterface $localeLists */ public function __construct(ListsInterface $localeLists) diff --git a/app/code/Magento/Directory/Setup/InstallData.php b/app/code/Magento/Directory/Setup/InstallData.php index 165e9c08d8c09..f3b0a8b9192c4 100644 --- a/app/code/Magento/Directory/Setup/InstallData.php +++ b/app/code/Magento/Directory/Setup/InstallData.php @@ -14,10 +14,17 @@ class InstallData implements InstallDataInterface { /** + * Directory data + * * @var Data */ private $directoryData; + /** + * Init + * + * @param Data $directoryData + */ public function __construct(Data $directoryData) { $this->directoryData = $directoryData; diff --git a/app/code/Magento/Downloadable/Setup/InstallData.php b/app/code/Magento/Downloadable/Setup/InstallData.php index 536df8afc1bbd..5a4e8b61a559c 100644 --- a/app/code/Magento/Downloadable/Setup/InstallData.php +++ b/app/code/Magento/Downloadable/Setup/InstallData.php @@ -14,11 +14,15 @@ class InstallData implements InstallDataInterface { /** + * EAV setup factory + * * @var EavSetupFactory */ private $eavSetupFactory; /** + * Init + * * @param EavSetupFactory $eavSetupFactory */ public function __construct(EavSetupFactory $eavSetupFactory) @@ -152,7 +156,10 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface // make these attributes applicable to downloadable products foreach ($fieldList as $field) { - $applyTo = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')); + $applyTo = explode( + ',', + $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to') + ); if (!in_array('downloadable', $applyTo)) { $applyTo[] = 'downloadable'; $eavSetup->updateAttribute( diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php index 7683c913f8315..ceec799644657 100644 --- a/app/code/Magento/Eav/Setup/EavSetup.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -17,21 +17,29 @@ class EavSetup { /** + * Cache + * * @var CacheInterface */ private $cache; /** + * Attribute group collection factory + * * @var CollectionFactory */ private $attrGroupCollectionFactory; /** + * Attribute mapper + * * @var PropertyMapperInterface */ private $attributeMapper; /** + * Setup model + * * @var ModuleDataSetupInterface */ private $setup; @@ -65,6 +73,8 @@ class EavSetup private $_defaultAttributeSetName = 'Default'; /** + * Init + * * @param ModuleDataSetupInterface $setup * @param Context $context * @param CacheInterface $cache @@ -83,6 +93,8 @@ public function __construct( } /** + * Gets setup model + * * @return ModuleDataSetupInterface */ public function getSetup() @@ -91,6 +103,8 @@ public function getSetup() } /** + * Gets attribute group collection factory + * * @return \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection */ public function getAttributeGroupCollectionFactory() @@ -198,7 +212,13 @@ public function addEntityType($code, array $params) */ public function updateEntityType($code, $field, $value = null) { - $this->setup->updateTableRow('eav_entity_type', 'entity_type_id', $this->getEntityTypeId($code), $field, $value); + $this->setup->updateTableRow( + 'eav_entity_type', + 'entity_type_id', + $this->getEntityTypeId($code), + $field, + $value + ); return $this; } @@ -381,7 +401,11 @@ public function getAttributeSetId($entityTypeId, $setId) */ public function removeAttributeSet($entityTypeId, $id) { - $this->setup->deleteTableRow('eav_attribute_set', 'attribute_set_id', $this->getAttributeSetId($entityTypeId, $id)); + $this->setup->deleteTableRow( + 'eav_attribute_set', + 'attribute_set_id', + $this->getAttributeSetId($entityTypeId, $id) + ); return $this; } @@ -408,7 +432,8 @@ public function setDefaultSetToEntityType($entityType, $attributeSet = 'Default' */ public function getAllAttributeSetIds($entityTypeId = null) { - $select = $this->setup->getConnection()->select()->from($this->setup->getTable('eav_attribute_set'), 'attribute_set_id'); + $select = $this->setup->getConnection()->select() + ->from($this->setup->getTable('eav_attribute_set'), 'attribute_set_id'); $bind = []; if ($entityTypeId !== null) { @@ -990,7 +1015,7 @@ public function getAttribute($entityTypeId, $id, $field = null) $setupCache->setRow($mainTable, $entityTypeId, $id, false); } else { $setupCache->setRow($mainTable, $entityTypeId, $row['attribute_id'], $row); - $setupCache->setRow($mainTable, $entityTypeId, $row['attribute_code'],$row); + $setupCache->setRow($mainTable, $entityTypeId, $row['attribute_code'], $row); } } @@ -1073,8 +1098,9 @@ public function removeAttribute($entityTypeId, $code) $attribute = $this->getAttribute($entityTypeId, $code); if ($attribute) { $this->setup->deleteTableRow('eav_attribute', 'attribute_id', $attribute['attribute_id']); - if (isset($this->setup->getSetupCache()[$mainTable][$attribute['entity_type_id']][$attribute['attribute_code']])) { - unset($this->setup->getSetupCache()[$mainTable][$attribute['entity_type_id']][$attribute['attribute_code']]); + $setupCache = $this->setup->getSetupCache(); + if ($setupCache->has($mainTable, $attribute['entity_type_id'], $attribute['attribute_code'])) { + $setupCache->remove($mainTable, $attribute['entity_type_id'], $attribute['attribute_code']); } } return $this; @@ -1226,6 +1252,16 @@ public function addAttributeToGroup($entityType, $setId, $groupId, $attributeId, /******************* BULK INSTALL *****************/ + /** + * Gets default entities and attributes + * + * @return array + */ + public function getDefaultEntities() + { + return []; + } + /** * Install entities * @@ -1256,8 +1292,6 @@ public function installEntities($entities = null) $attr['backend'] = $backendPrefix; } elseif ('_' === $attr['backend'][0]) { $attr['backend'] = $backendPrefix . $attr['backend']; - } else { - $attr['backend'] = $attr['backend']; } } if (!empty($attr['frontend'])) { @@ -1265,8 +1299,6 @@ public function installEntities($entities = null) $attr['frontend'] = $frontendPrefix; } elseif ('_' === $attr['frontend'][0]) { $attr['frontend'] = $frontendPrefix . $attr['frontend']; - } else { - $attr['frontend'] = $attr['frontend']; } } if (!empty($attr['source'])) { @@ -1274,8 +1306,6 @@ public function installEntities($entities = null) $attr['source'] = $sourcePrefix; } elseif ('_' === $attr['source'][0]) { $attr['source'] = $sourcePrefix . $attr['source']; - } else { - $attr['source'] = $attr['source']; } } diff --git a/app/code/Magento/Eav/Setup/InstallData.php b/app/code/Magento/Eav/Setup/InstallData.php index 1150c5cd2f340..da79960e57bf1 100644 --- a/app/code/Magento/Eav/Setup/InstallData.php +++ b/app/code/Magento/Eav/Setup/InstallData.php @@ -13,11 +13,15 @@ class InstallData implements InstallDataInterface { /** + * EAV setup factory + * * @var EavSetupFactory */ private $eavSetupFactory; /** + * Init + * * @param EavSetupFactory $eavSetupFactory */ public function __construct(EavSetupFactory $eavSetupFactory) diff --git a/app/code/Magento/Fedex/Setup/InstallData.php b/app/code/Magento/Fedex/Setup/InstallData.php index 8b979f44ba427..c84faaa45dcf9 100755 --- a/app/code/Magento/Fedex/Setup/InstallData.php +++ b/app/code/Magento/Fedex/Setup/InstallData.php @@ -1,10 +1,8 @@ [ 'EUROPEFIRSTINTERNATIONALPRIORITY' => 'EUROPE_FIRST_INTERNATIONAL_PRIORITY', @@ -103,5 +101,5 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface } } - } + } } \ No newline at end of file diff --git a/app/code/Magento/GiftMessage/Setup/InstallData.php b/app/code/Magento/GiftMessage/Setup/InstallData.php index 01f42ce3e0798..69160be0eea3e 100644 --- a/app/code/Magento/GiftMessage/Setup/InstallData.php +++ b/app/code/Magento/GiftMessage/Setup/InstallData.php @@ -15,22 +15,30 @@ class InstallData implements InstallDataInterface { /** + * Category setup factory + * * @var CategorySetupFactory */ protected $categorySetupFactory; /** + * Quote setup factory + * * @var QuoteSetupFactory */ protected $quoteSetupFactory; /** + * Sales setup factory + * * @var SalesSetupFactory */ protected $salesSetupFactory; /** + * Init + * * @param CategorySetupFactory $categorySetupFactory * @param QuoteSetupFactory $quoteSetupFactory * @param SalesSetupFactory $salesSetupFactory diff --git a/app/code/Magento/GoogleShopping/Setup/InstallData.php b/app/code/Magento/GoogleShopping/Setup/InstallData.php index baa4d0198bc64..d2e55aa0f333d 100644 --- a/app/code/Magento/GoogleShopping/Setup/InstallData.php +++ b/app/code/Magento/GoogleShopping/Setup/InstallData.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\GoogleShopping\Setup; use Magento\Framework\Module\Manager; @@ -17,16 +15,22 @@ class InstallData implements InstallDataInterface { /** + * Configuration factory + * * @var ConfigFactory */ private $configFactory; /** + * Modules manager + * * @var Manager */ private $moduleManager; /** + * Init + * * @param ConfigFactory $configFactory * @param Manager $moduleManager */ @@ -68,7 +72,9 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface [ 'id', 'attribute_id', - 'gbase_attribute' => new \Zend_Db_Expr("IF(gbase_attribute IN ({$attributes}), gbase_attribute, '')"), + 'gbase_attribute' => new \Zend_Db_Expr( + "IF(gbase_attribute IN ({$attributes}), gbase_attribute, '')" + ), 'type_id' ] )->insertFromSelect( diff --git a/app/code/Magento/Log/Setup/InstallData.php b/app/code/Magento/Log/Setup/InstallData.php index 53df67b0615a7..30c1fc64f0b89 100755 --- a/app/code/Magento/Log/Setup/InstallData.php +++ b/app/code/Magento/Log/Setup/InstallData.php @@ -1,10 +1,8 @@ 1, 'type_code' => 'hour', 'period' => 1, 'period_type' => 'HOUR'], - ['type_id' => 2, 'type_code' => 'day', 'period' => 1, 'period_type' => 'DAY'], - ]; - - foreach ($data as $bind) { - $installer->getConnection()->insertForce($installer->getTable('log_summary_type'), $bind); - } - - } + /** + * {@inheritdoc} + */ + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $data = [ + ['type_id' => 1, 'type_code' => 'hour', 'period' => 1, 'period_type' => 'HOUR'], + ['type_id' => 2, 'type_code' => 'day', 'period' => 1, 'period_type' => 'DAY'], + ]; + + foreach ($data as $bind) { + $installer->getConnection()->insertForce($installer->getTable('log_summary_type'), $bind); + } + + } } \ No newline at end of file diff --git a/app/code/Magento/Msrp/Setup/InstallData.php b/app/code/Magento/Msrp/Setup/InstallData.php index 95b4010c4e031..cc014f4118730 100644 --- a/app/code/Magento/Msrp/Setup/InstallData.php +++ b/app/code/Magento/Msrp/Setup/InstallData.php @@ -14,11 +14,15 @@ class InstallData implements InstallDataInterface { /** + * EAV setup factory + * * @var EavSetupFactory */ private $eavSetupFactory; /** + * Init + * * @param EavSetupFactory $eavSetupFactory */ public function __construct(EavSetupFactory $eavSetupFactory) diff --git a/app/code/Magento/Quote/Setup/InstallData.php b/app/code/Magento/Quote/Setup/InstallData.php index f4d1684ddda0c..ebe933d4b2d8a 100644 --- a/app/code/Magento/Quote/Setup/InstallData.php +++ b/app/code/Magento/Quote/Setup/InstallData.php @@ -13,11 +13,15 @@ class InstallData implements InstallDataInterface { /** + * Quote setup factory + * * @var QuoteSetupFactory */ private $quoteSetupFactory; /** + * Init + * * @param QuoteSetupFactory $setupFactory */ public function __construct(QuoteSetupFactory $setupFactory) diff --git a/app/code/Magento/Reports/Setup/InstallData.php b/app/code/Magento/Reports/Setup/InstallData.php index 51b3ad7abe7d3..65fb98e8d10bd 100644 --- a/app/code/Magento/Reports/Setup/InstallData.php +++ b/app/code/Magento/Reports/Setup/InstallData.php @@ -13,11 +13,15 @@ class InstallData implements \Magento\Framework\Setup\InstallDataInterface { /** + * Page factory + * * @var PageFactory */ private $pageFactory; /** + * Init + * * @param PageFactory $pageFactory */ public function __construct(PageFactory $pageFactory) diff --git a/app/code/Magento/Review/Setup/InstallData.php b/app/code/Magento/Review/Setup/InstallData.php index 0a4f2223d0381..364258699b330 100755 --- a/app/code/Magento/Review/Setup/InstallData.php +++ b/app/code/Magento/Review/Setup/InstallData.php @@ -1,10 +1,8 @@ getConnection()->insert($installer->getTable('review_entity'), ['entity_code' => $entityCode]); - } - - //Fill table review/review_entity - $reviewStatuses = [ - \Magento\Review\Model\Review::STATUS_APPROVED => 'Approved', - \Magento\Review\Model\Review::STATUS_PENDING => 'Pending', - \Magento\Review\Model\Review::STATUS_NOT_APPROVED => 'Not Approved', - ]; - foreach ($reviewStatuses as $k => $v) { - $bind = ['status_id' => $k, 'status_code' => $v]; - $installer->getConnection()->insertForce($installer->getTable('review_status'), $bind); - } - - $data = [ - \Magento\Review\Model\Rating::ENTITY_PRODUCT_CODE => [ - ['rating_code' => 'Quality', 'position' => 0], - ['rating_code' => 'Value', 'position' => 0], - ['rating_code' => 'Price', 'position' => 0], - ], - \Magento\Review\Model\Rating::ENTITY_PRODUCT_REVIEW_CODE => [], - \Magento\Review\Model\Rating::ENTITY_REVIEW_CODE => [], - ]; - - foreach ($data as $entityCode => $ratings) { - //Fill table rating/rating_entity - $installer->getConnection()->insert($installer->getTable('rating_entity'), ['entity_code' => $entityCode]); - $entityId = $installer->getConnection()->lastInsertId($installer->getTable('rating_entity')); - - foreach ($ratings as $bind) { - //Fill table rating/rating - $bind['entity_id'] = $entityId; - $installer->getConnection()->insert($installer->getTable('rating'), $bind); - - //Fill table rating/rating_option - $ratingId = $installer->getConnection()->lastInsertId($installer->getTable('rating')); - $optionData = []; - for ($i = 1; $i <= 5; $i++) { - $optionData[] = ['rating_id' => $ratingId, 'code' => (string)$i, 'value' => $i, 'position' => $i]; - } - $installer->getConnection()->insertMultiple($installer->getTable('rating_option'), $optionData); - } - } - - } + /** + * {@inheritdoc} + */ + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + //Fill table review/review_entity + $reviewEntityCodes = [ + \Magento\Review\Model\Review::ENTITY_PRODUCT_CODE, + \Magento\Review\Model\Review::ENTITY_CUSTOMER_CODE, + \Magento\Review\Model\Review::ENTITY_CATEGORY_CODE, + ]; + foreach ($reviewEntityCodes as $entityCode) { + $installer->getConnection()->insert($installer->getTable('review_entity'), ['entity_code' => $entityCode]); + } + + //Fill table review/review_entity + $reviewStatuses = [ + \Magento\Review\Model\Review::STATUS_APPROVED => 'Approved', + \Magento\Review\Model\Review::STATUS_PENDING => 'Pending', + \Magento\Review\Model\Review::STATUS_NOT_APPROVED => 'Not Approved', + ]; + foreach ($reviewStatuses as $k => $v) { + $bind = ['status_id' => $k, 'status_code' => $v]; + $installer->getConnection()->insertForce($installer->getTable('review_status'), $bind); + } + + $data = [ + \Magento\Review\Model\Rating::ENTITY_PRODUCT_CODE => [ + ['rating_code' => 'Quality', 'position' => 0], + ['rating_code' => 'Value', 'position' => 0], + ['rating_code' => 'Price', 'position' => 0], + ], + \Magento\Review\Model\Rating::ENTITY_PRODUCT_REVIEW_CODE => [], + \Magento\Review\Model\Rating::ENTITY_REVIEW_CODE => [], + ]; + + foreach ($data as $entityCode => $ratings) { + //Fill table rating/rating_entity + $installer->getConnection()->insert($installer->getTable('rating_entity'), ['entity_code' => $entityCode]); + $entityId = $installer->getConnection()->lastInsertId($installer->getTable('rating_entity')); + + foreach ($ratings as $bind) { + //Fill table rating/rating + $bind['entity_id'] = $entityId; + $installer->getConnection()->insert($installer->getTable('rating'), $bind); + + //Fill table rating/rating_option + $ratingId = $installer->getConnection()->lastInsertId($installer->getTable('rating')); + $optionData = []; + for ($i = 1; $i <= 5; $i++) { + $optionData[] = ['rating_id' => $ratingId, 'code' => (string)$i, 'value' => $i, 'position' => $i]; + } + $installer->getConnection()->insertMultiple($installer->getTable('rating_option'), $optionData); + } + } + + } } \ No newline at end of file diff --git a/app/code/Magento/Sales/Setup/InstallData.php b/app/code/Magento/Sales/Setup/InstallData.php index 4367c781d0a1f..cf11872833d0a 100644 --- a/app/code/Magento/Sales/Setup/InstallData.php +++ b/app/code/Magento/Sales/Setup/InstallData.php @@ -12,11 +12,15 @@ class InstallData implements InstallDataInterface { /** + * Sales setup factory + * * @var SalesSetupFactory */ private $salesSetupFactory; /** + * Init + * * @param SalesSetupFactory $salesSetupFactory */ public function __construct(SalesSetupFactory $salesSetupFactory) diff --git a/app/code/Magento/SalesRule/Setup/InstallData.php b/app/code/Magento/SalesRule/Setup/InstallData.php index cb85ab8b45ad1..fb9d10de36465 100755 --- a/app/code/Magento/SalesRule/Setup/InstallData.php +++ b/app/code/Magento/SalesRule/Setup/InstallData.php @@ -1,10 +1,8 @@ createMigrationSetup(); - $setup->startSetup(); - - $installer->appendClassAliasReplace( - 'salesrule', - 'conditions_serialized', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, - ['rule_id'] - ); - $installer->appendClassAliasReplace( - 'salesrule', - 'actions_serialized', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, - ['rule_id'] - ); - - $installer->doUpdateClassAliases(); - - $setup->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup->createMigrationSetup(); + $setup->startSetup(); + + $installer->appendClassAliasReplace( + 'salesrule', + 'conditions_serialized', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + ['rule_id'] + ); + $installer->appendClassAliasReplace( + 'salesrule', + 'actions_serialized', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + ['rule_id'] + ); + + $installer->doUpdateClassAliases(); + + $setup->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Tax/Setup/InstallData.php b/app/code/Magento/Tax/Setup/InstallData.php index 9a604c7c1b206..c3485e73e978f 100644 --- a/app/code/Magento/Tax/Setup/InstallData.php +++ b/app/code/Magento/Tax/Setup/InstallData.php @@ -12,11 +12,15 @@ class InstallData implements InstallDataInterface { /** + * Tax setup factory + * * @var TaxSetupFactory */ private $taxSetupFactory; /** + * Init + * * @param TaxSetupFactory $taxSetupFactory */ public function __construct(TaxSetupFactory $taxSetupFactory) diff --git a/app/code/Magento/Tax/Setup/TaxSetup.php b/app/code/Magento/Tax/Setup/TaxSetup.php index 1c502d4b59e65..f55ade276e145 100644 --- a/app/code/Magento/Tax/Setup/TaxSetup.php +++ b/app/code/Magento/Tax/Setup/TaxSetup.php @@ -21,16 +21,22 @@ class TaxSetup extends SalesSetup { /** + * Category setup factory + * * @var CategorySetupFactory */ protected $_setupFactory; /** + * Product type config + * * @var ConfigInterface */ protected $productTypeConfig; /** + * Init + * * @param ModuleDataSetupInterface $setup * @param Context $context * @param CacheInterface $cache @@ -53,6 +59,8 @@ public function __construct( } /** + * Gets catalog setup + * * @param array $data * @return CategorySetup */ diff --git a/app/code/Magento/Theme/Setup/InstallData.php b/app/code/Magento/Theme/Setup/InstallData.php index 5eb5fbb2b383c..eb2442680c0ef 100644 --- a/app/code/Magento/Theme/Setup/InstallData.php +++ b/app/code/Magento/Theme/Setup/InstallData.php @@ -12,16 +12,22 @@ class InstallData implements InstallDataInterface { /** + * Theme resource factory + * * @var \Magento\Theme\Model\Resource\Theme\CollectionFactory */ private $themeResourceFactory; /** + * Theme collection factory + * * @var \Magento\Theme\Model\Theme\CollectionFactory */ private $themeFactory; /** + * Init + * * @param \Magento\Theme\Model\Resource\Theme\CollectionFactory $themeResourceFactory * @param \Magento\Theme\Model\Theme\CollectionFactory $themeFactory */ @@ -38,7 +44,6 @@ public function __construct( */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { - $installer = $setup->createMigrationSetup(); $setup->startSetup(); /* diff --git a/app/code/Magento/Usps/Setup/InstallData.php b/app/code/Magento/Usps/Setup/InstallData.php index 9db1c40ba1fa1..c58bdf89c0f19 100755 --- a/app/code/Magento/Usps/Setup/InstallData.php +++ b/app/code/Magento/Usps/Setup/InstallData.php @@ -1,10 +1,8 @@ getTable('core_config_data'); - $connection = $installer->getConnection(); - - $oldToNewMethodCodesMap = [ - 'First-Class' => '0_FCLE', - 'First-Class Mail International Large Envelope' => 'INT_14', - 'First-Class Mail International Letter' => 'INT_13', - 'First-Class Mail International Letters' => 'INT_13', - 'First-Class Mail International Package' => 'INT_15', - 'First-Class Mail International Parcel' => 'INT_13', - 'First-Class Package International Service' => 'INT_15', - 'First-Class Mail' => '0_FCLE', - 'First-Class Mail Flat' => '0_FCLE', - 'First-Class Mail Large Envelope' => '0_FCLE', - 'First-Class Mail International' => 'INT_14', - 'First-Class Mail Letter' => '0_FCL', - 'First-Class Mail Parcel' => '0_FCP', - 'First-Class Mail Package' => '0_FCP', - 'Parcel Post' => '4', - 'Standard Post' => '4', - 'Media Mail' => '6', - 'Library Mail' => '7', - 'Express Mail' => '3', - 'Express Mail PO to PO' => '3', - 'Express Mail Flat Rate Envelope' => '13', - 'Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee' => '25', - 'Express Mail Sunday/Holiday Guarantee' => '23', - 'Express Mail Flat Rate Envelope Hold For Pickup' => '27', - 'Express Mail Hold For Pickup' => '2', - 'Global Express Guaranteed (GXG)' => 'INT_4', - 'Global Express Guaranteed Non-Document Rectangular' => 'INT_6', - 'Global Express Guaranteed Non-Document Non-Rectangular' => 'INT_7', - 'USPS GXG Envelopes' => 'INT_12', - 'Express Mail International' => 'INT_1', - 'Express Mail International Flat Rate Envelope' => 'INT_10', - 'Priority Mail' => '1', - 'Priority Mail Small Flat Rate Box' => '28', - 'Priority Mail Medium Flat Rate Box' => '17', - 'Priority Mail Large Flat Rate Box' => '22', - 'Priority Mail Flat Rate Envelope' => '16', - 'Priority Mail International' => 'INT_2', - 'Priority Mail International Flat Rate Envelope' => 'INT_8', - 'Priority Mail International Small Flat Rate Box' => 'INT_16', - 'Priority Mail International Medium Flat Rate Box' => 'INT_9', - 'Priority Mail International Large Flat Rate Box' => 'INT_11', - ]; - - $select = $connection->select()->from( - $configDataTable - )->where( - 'path IN (?)', - ['carriers/usps/free_method', 'carriers/usps/allowed_methods'] - ); - $oldConfigValues = $connection->fetchAll($select); - - foreach ($oldConfigValues as $oldValue) { - $newValue = ''; - if (stripos($oldValue['path'], 'free_method') && isset($oldToNewMethodCodesMap[$oldValue['value']])) { - $newValue = $oldToNewMethodCodesMap[$oldValue['value']]; - } elseif (stripos($oldValue['path'], 'allowed_methods')) { - $newValuesList = []; - foreach (explode(',', $oldValue['value']) as $shippingMethod) { - if (isset($oldToNewMethodCodesMap[$shippingMethod])) { - $newValuesList[] = $oldToNewMethodCodesMap[$shippingMethod]; - } - } - $newValue = implode(',', $newValuesList); - } else { - continue; - } - - if ($newValue && $newValue != $oldValue['value']) { - $whereConfigId = $connection->quoteInto('config_id = ?', $oldValue['config_id']); - $connection->update($configDataTable, ['value' => $newValue], $whereConfigId); - } - } - - } + /** + * {@inheritdoc} + */ + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $configDataTable = $installer->getTable('core_config_data'); + $connection = $installer->getConnection(); + + $oldToNewMethodCodesMap = [ + 'First-Class' => '0_FCLE', + 'First-Class Mail International Large Envelope' => 'INT_14', + 'First-Class Mail International Letter' => 'INT_13', + 'First-Class Mail International Letters' => 'INT_13', + 'First-Class Mail International Package' => 'INT_15', + 'First-Class Mail International Parcel' => 'INT_13', + 'First-Class Package International Service' => 'INT_15', + 'First-Class Mail' => '0_FCLE', + 'First-Class Mail Flat' => '0_FCLE', + 'First-Class Mail Large Envelope' => '0_FCLE', + 'First-Class Mail International' => 'INT_14', + 'First-Class Mail Letter' => '0_FCL', + 'First-Class Mail Parcel' => '0_FCP', + 'First-Class Mail Package' => '0_FCP', + 'Parcel Post' => '4', + 'Standard Post' => '4', + 'Media Mail' => '6', + 'Library Mail' => '7', + 'Express Mail' => '3', + 'Express Mail PO to PO' => '3', + 'Express Mail Flat Rate Envelope' => '13', + 'Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee' => '25', + 'Express Mail Sunday/Holiday Guarantee' => '23', + 'Express Mail Flat Rate Envelope Hold For Pickup' => '27', + 'Express Mail Hold For Pickup' => '2', + 'Global Express Guaranteed (GXG)' => 'INT_4', + 'Global Express Guaranteed Non-Document Rectangular' => 'INT_6', + 'Global Express Guaranteed Non-Document Non-Rectangular' => 'INT_7', + 'USPS GXG Envelopes' => 'INT_12', + 'Express Mail International' => 'INT_1', + 'Express Mail International Flat Rate Envelope' => 'INT_10', + 'Priority Mail' => '1', + 'Priority Mail Small Flat Rate Box' => '28', + 'Priority Mail Medium Flat Rate Box' => '17', + 'Priority Mail Large Flat Rate Box' => '22', + 'Priority Mail Flat Rate Envelope' => '16', + 'Priority Mail International' => 'INT_2', + 'Priority Mail International Flat Rate Envelope' => 'INT_8', + 'Priority Mail International Small Flat Rate Box' => 'INT_16', + 'Priority Mail International Medium Flat Rate Box' => 'INT_9', + 'Priority Mail International Large Flat Rate Box' => 'INT_11', + ]; + + $select = $connection->select()->from( + $configDataTable + )->where( + 'path IN (?)', + ['carriers/usps/free_method', 'carriers/usps/allowed_methods'] + ); + $oldConfigValues = $connection->fetchAll($select); + + foreach ($oldConfigValues as $oldValue) { + if (stripos($oldValue['path'], 'free_method') && isset($oldToNewMethodCodesMap[$oldValue['value']])) { + $newValue = $oldToNewMethodCodesMap[$oldValue['value']]; + } elseif (stripos($oldValue['path'], 'allowed_methods')) { + $newValuesList = []; + foreach (explode(',', $oldValue['value']) as $shippingMethod) { + if (isset($oldToNewMethodCodesMap[$shippingMethod])) { + $newValuesList[] = $oldToNewMethodCodesMap[$shippingMethod]; + } + } + $newValue = implode(',', $newValuesList); + } else { + continue; + } + + if ($newValue && $newValue != $oldValue['value']) { + $whereConfigId = $connection->quoteInto('config_id = ?', $oldValue['config_id']); + $connection->update($configDataTable, ['value' => $newValue], $whereConfigId); + } + } + + } } \ No newline at end of file diff --git a/app/code/Magento/Weee/Setup/InstallData.php b/app/code/Magento/Weee/Setup/InstallData.php index 2e0807ba0415a..f548199838c1f 100644 --- a/app/code/Magento/Weee/Setup/InstallData.php +++ b/app/code/Magento/Weee/Setup/InstallData.php @@ -16,16 +16,22 @@ class InstallData implements InstallDataInterface { /** + * Sales setup factory + * * @var SalesSetupFactory */ private $salesSetupFactory; /** + * Quote setup factory + * * @var QuoteSetupFactory */ private $quoteSetupFactory; /** + * Init + * * @param SalesSetupFactory $salesSetupFactory * @param QuoteSetupFactory $quoteSetupFactory */ diff --git a/app/code/Magento/Widget/Setup/InstallData.php b/app/code/Magento/Widget/Setup/InstallData.php index 726cf60a34560..d557637806c13 100755 --- a/app/code/Magento/Widget/Setup/InstallData.php +++ b/app/code/Magento/Widget/Setup/InstallData.php @@ -1,10 +1,8 @@ createMigrationSetup(); - $setup->startSetup(); - - $installer->appendClassAliasReplace( - 'widget_instance', - 'instance_type', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - ['instance_id'] - ); - $installer->doUpdateClassAliases(); + /** + * {@inheritdoc} + */ + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup->createMigrationSetup(); + $setup->startSetup(); + + $installer->appendClassAliasReplace( + 'widget_instance', + 'instance_type', + \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + ['instance_id'] + ); + $installer->doUpdateClassAliases(); - $setup->endSetup(); - - } + $setup->endSetup(); + + } } \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Module/Setup.php b/lib/internal/Magento/Framework/Module/Setup.php index 390d7f0d682af..396c24baf5d02 100644 --- a/lib/internal/Magento/Framework/Module/Setup.php +++ b/lib/internal/Magento/Framework/Module/Setup.php @@ -41,6 +41,8 @@ class Setup implements SetupInterface private $connectionName; /** + * Init + * * @param \Magento\Framework\App\Resource $resource * @param string $connectionName */ diff --git a/lib/internal/Magento/Framework/Setup/DataCacheInterface.php b/lib/internal/Magento/Framework/Setup/DataCacheInterface.php index 915efbcdbb9b5..eb5b89d1206c3 100644 --- a/lib/internal/Magento/Framework/Setup/DataCacheInterface.php +++ b/lib/internal/Magento/Framework/Setup/DataCacheInterface.php @@ -8,7 +8,8 @@ /** * Data setup cache */ -interface DataCacheInterface { +interface DataCacheInterface +{ /** * Set data of a row * @@ -28,6 +29,7 @@ public function setRow($table, $parentId, $rowId, $value); * @param string $rowId * @param string $field * @param mixed $value + * @return void */ public function setField($table, $parentId, $rowId, $field, $value); diff --git a/lib/internal/Magento/Framework/Setup/ModuleDataSetupInterface.php b/lib/internal/Magento/Framework/Setup/ModuleDataSetupInterface.php index 01fce5b13aac2..a13b1a9d2823f 100644 --- a/lib/internal/Magento/Framework/Setup/ModuleDataSetupInterface.php +++ b/lib/internal/Magento/Framework/Setup/ModuleDataSetupInterface.php @@ -58,7 +58,6 @@ public function deleteTableRow($table, $idField, $rowId, $parentField = null, $p * @param string $parentField * @param string|integer $parentId * @return $this - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function updateTableRow($table, $idField, $rowId, $field, $value = null, $parentField = null, $parentId = 0); @@ -66,13 +65,12 @@ public function updateTableRow($table, $idField, $rowId, $field, $value = null, * Check call afterApplyAllUpdates method for setup class * * @return bool - * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ public function getCallAfterApplyAllUpdates(); /** * Run each time after applying of all updates, - * if setup model setted $_callAfterApplyAllUpdates flag to true + * if setup model set $_callAfterApplyAllUpdates flag to true * * @return $this */ @@ -86,6 +84,8 @@ public function afterApplyAllUpdates(); public function getEventManager(); /** + * Gets filesystem + * * @return \Magento\Framework\Filesystem */ public function getFilesystem(); diff --git a/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php b/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php index 88e28cd3c18b9..4e83f2dc3c2df 100644 --- a/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php +++ b/lib/internal/Magento/Framework/Setup/UpgradeSchemaInterface.php @@ -15,7 +15,7 @@ interface UpgradeSchemaInterface * * @param SchemaSetupInterface $setup * @param ModuleContextInterface $context - * @return + * @return void */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context); } diff --git a/setup/src/Magento/Setup/Model/ModuleContext.php b/setup/src/Magento/Setup/Model/ModuleContext.php index 1e76f5108bedd..f9385816ba661 100644 --- a/setup/src/Magento/Setup/Model/ModuleContext.php +++ b/setup/src/Magento/Setup/Model/ModuleContext.php @@ -20,6 +20,8 @@ class ModuleContext implements ModuleContextInterface private $version; /** + * Init + * * @param string $version Current version of a module */ public function __construct($version) diff --git a/setup/src/Magento/Setup/Module/DataSetup.php b/setup/src/Magento/Setup/Module/DataSetup.php index 70e5151040db8..b60a23bab8e89 100644 --- a/setup/src/Magento/Setup/Module/DataSetup.php +++ b/setup/src/Magento/Setup/Module/DataSetup.php @@ -35,21 +35,22 @@ class DataSetup extends \Magento\Framework\Module\Setup implements ModuleDataSet private $_modulesReader; /** + * Event manager + * * @var \Magento\Framework\Event\ManagerInterface */ private $_eventManager; /** + * Logger + * * @var \Psr\Log\LoggerInterface */ private $_logger; /** - * @var \Magento\Framework\Module\ResourceInterface - */ - private $_resource; - - /** + * Migration factory + * * @var \Magento\Framework\Module\Setup\MigrationFactory */ private $_migrationFactory; @@ -62,11 +63,15 @@ class DataSetup extends \Magento\Framework\Module\Setup implements ModuleDataSet private $filesystem; /** + * Modules list object + * * @var \Magento\Framework\Filesystem\Directory\ReadInterface */ private $modulesDir; /** + * Init + * * @param \Magento\Framework\Module\Setup\Context $context * @param string $connectionName */ @@ -78,7 +83,6 @@ public function __construct( $this->_eventManager = $context->getEventManager(); $this->_logger = $context->getLogger(); $this->_modulesReader = $context->getModulesReader(); - $this->_resource = $context->getResource(); $this->_migrationFactory = $context->getMigrationFactory(); $this->filesystem = $context->getFilesystem(); $this->modulesDir = $this->filesystem->getDirectoryRead(DirectoryList::MODULES); @@ -216,6 +220,8 @@ public function afterApplyAllUpdates() } /** + * Gets event manager + * * @return \Magento\Framework\Event\ManagerInterface */ public function getEventManager() @@ -224,6 +230,8 @@ public function getEventManager() } /** + * Gets filesystem + * * @return \Magento\Framework\Filesystem */ public function getFilesystem() diff --git a/setup/src/Magento/Setup/Module/SetupFactory.php b/setup/src/Magento/Setup/Module/SetupFactory.php index d384788095ae2..6398b9b587acc 100644 --- a/setup/src/Magento/Setup/Module/SetupFactory.php +++ b/setup/src/Magento/Setup/Module/SetupFactory.php @@ -11,6 +11,8 @@ class SetupFactory { /** + * Service locator + * * @var ServiceLocatorInterface */ private $serviceLocator; From 063c75524c0d1f069c797e28c0bbceac2b88b9d6 Mon Sep 17 00:00:00 2001 From: Safwan Khan Date: Tue, 17 Feb 2015 18:57:13 -0600 Subject: [PATCH 047/106] MAGETWO-33888: Change setup framework to use SPI classes - Added/modified corresponding tests. --- .../Test/Legacy/_files/obsolete_classes.php | 5 + .../Module/Updater/SetupFactoryTest.php | 54 ++++---- .../_files/Bar/Two/Setup/UpgradeData.php} | 2 +- .../_files/Foo/One/Setup/InstallData.php} | 2 +- .../Magento/Framework/Module/UpdaterTest.php | 99 ++++++++------ .../Setup/Model/InstallerFactoryTest.php | 15 ++- .../Magento/Setup/Model/InstallerTest.php | 36 +++-- .../ModuleInstallerUpgraderFactoryTest.php | 56 ++++++++ .../Setup/Module/Setup/FileResolverTest.php | 69 ---------- .../Magento/Setup/Module/SetupFactoryTest.php | 38 +----- .../Magento/Setup/Module/SetupModuleTest.php | 124 ------------------ .../Two/Setup/UpgradeSchema.php} | 2 +- .../One/Setup/InstallSchema.php} | 2 +- .../Magento/Setup/Module/_files/recurring.php | 5 - .../Framework/Module/Updater/SetupFactory.php | 3 +- 15 files changed, 192 insertions(+), 320 deletions(-) rename dev/tests/unit/testsuite/Magento/{Setup/Module/_files/Magento/Module2/sql/module2_setup/install.php => Framework/Module/Updater/_files/Bar/Two/Setup/UpgradeData.php} (96%) rename dev/tests/unit/testsuite/Magento/{Setup/Module/_files/Magento/Module3/data/module3_setup/data-install.php => Framework/Module/Updater/_files/Foo/One/Setup/InstallData.php} (96%) create mode 100644 dev/tests/unit/testsuite/Magento/Setup/Module/ModuleInstallerUpgraderFactoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Setup/Module/Setup/FileResolverTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Setup/Module/SetupModuleTest.php rename dev/tests/unit/testsuite/Magento/Setup/Module/_files/{Magento/Module1/data/module1_setup/data-install.php => Bar/Two/Setup/UpgradeSchema.php} (96%) rename dev/tests/unit/testsuite/Magento/Setup/Module/_files/{Magento/Module1/sql/module1_setup/install.php => Foo/One/Setup/InstallSchema.php} (96%) delete mode 100644 dev/tests/unit/testsuite/Magento/Setup/Module/_files/recurring.php diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index e8ca31f4dac3d..cb3a632b5fd59 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -2933,4 +2933,9 @@ ['Magento\Theme\Model\Resource\Setup', 'Magento\Theme\Setup\InstallData'], ['Magento\Weee\Model\Resource\Setup', 'Magento\Weee\Setup\InstallData'], ['Magento\Integration\Model\Resource\Setup', 'Magento\Integration\Model\Manager::processIntegrationConfig()'], + ['Magento\Framework\Module\ResourceResolver'], + ['Magento\Framework\Module\ResourceResolverInterface'], + ['Magento\Framework\Setup\ModuleSchemaResourceInterface'], + ['Magento\Setup\Module\SetupModule'], + ['Magento\Setup\Module\Setup\FileResolver'], ]; diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php index 47630cf73ba63..49099f94c0a95 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/SetupFactoryTest.php @@ -10,44 +10,46 @@ class SetupFactoryTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $objectManagerMock; + protected $directoryList; protected function setUp() { - $this->objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface'); + $this->directoryList = $this->getMock('Magento\Framework\App\Filesystem\DirectoryList', [], [], '', false); + $this->directoryList + ->expects($this->exactly(2)) + ->method('getPath') + ->will($this->returnValue(__DIR__ . '/_files')); } - public function testCreateUsesDefaultSetupModelClassIfSetupModelIsNotDeclaredForGivenResource() + public function testCreateInstaller() { + $objectManagerMock = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface'); + $objectManagerMock + ->expects($this->any()) + ->method('create') + ->with('Foo\One\Setup\InstallData') + ->will($this->returnValue($this->getMockForAbstractClass('Magento\Framework\Setup\InstallDataInterface'))); $model = new SetupFactory( - $this->objectManagerMock, - [] + $objectManagerMock, + $this->directoryList ); - $resourceName = 'module_setup'; - $moduleName = 'module'; - $this->objectManagerMock->expects($this->once())->method('create') - ->with( - '\Magento\Framework\Setup\ModuleDataSetupInterface', - [ - 'resourceName' => $resourceName, - 'moduleName' => $moduleName, - ] - ); - $model->create($resourceName, $moduleName); + $installer = $model->create('Foo_One', 'install'); + $this->assertInstanceOf('Magento\Framework\Setup\InstallDataInterface', $installer); } - /** - * @expectedException \LogicException - * @expectedExceptionMessage \Not\Valid\Setup\Model must implement \\Magento\Framework\Setup\ModuleDataSetupInterface - */ - public function testCreateThrowsExceptionIfSetupModelIsNotValid() + public function testCreateUpgrader() { + $objectManagerMock = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface'); + $objectManagerMock + ->expects($this->any()) + ->method('create') + ->with('Bar\Two\Setup\UpgradeData') + ->will($this->returnValue($this->getMockForAbstractClass('Magento\Framework\Setup\UpgradeDataInterface'))); $model = new SetupFactory( - $this->objectManagerMock, - [ - 'module_setup' => '\Not\Valid\Setup\Model', - ] + $objectManagerMock, + $this->directoryList ); - $model->create('module_setup', 'module'); + $upgrader = $model->create('Bar_Two', 'upgrade'); + $this->assertInstanceOf('Magento\Framework\Setup\UpgradeDataInterface', $upgrader); } } diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module2/sql/module2_setup/install.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/_files/Bar/Two/Setup/UpgradeData.php similarity index 96% rename from dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module2/sql/module2_setup/install.php rename to dev/tests/unit/testsuite/Magento/Framework/Module/Updater/_files/Bar/Two/Setup/UpgradeData.php index 25f63440e1a2d..da576e1679422 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module2/sql/module2_setup/install.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/_files/Bar/Two/Setup/UpgradeData.php @@ -2,4 +2,4 @@ /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. - */ + */ \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module3/data/module3_setup/data-install.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/_files/Foo/One/Setup/InstallData.php similarity index 96% rename from dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module3/data/module3_setup/data-install.php rename to dev/tests/unit/testsuite/Magento/Framework/Module/Updater/_files/Foo/One/Setup/InstallData.php index 25f63440e1a2d..da576e1679422 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module3/data/module3_setup/data-install.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Updater/_files/Foo/One/Setup/InstallData.php @@ -2,4 +2,4 @@ /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. - */ + */ \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php index 0a26733711966..c708b9b2d3398 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php @@ -15,18 +15,13 @@ class UpdaterTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_resourceResolver; + protected $dataSetup; /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $_moduleListMock; - /** - * @var \Magento\Framework\Setup\ModuleDataSetupInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $_resourceSetupMock; - /** * @var \Magento\Framework\Module\DbVersionInfo|\PHPUnit_Framework_MockObject_MockObject */ @@ -46,61 +41,83 @@ protected function setUp() '', false ); + $this->dataSetup = $this->getMock('Magento\Setup\Module\DataSetup', [], [], '', false); $this->_moduleListMock = $this->getMock('Magento\Framework\Module\ModuleListInterface'); - $this->_resourceResolver = $this->getMock('Magento\Framework\Module\ResourceResolverInterface'); - $this->_resourceSetupMock = $this->getMock( - '\Magento\Framework\Setup\ModuleDataSetupInterface', - [], - [], - '', - false - ); - - $this->_moduleListMock->expects($this->any())->method('getNames')->will($this->returnValue(['Test_Module'])); - - $resourceList = ['catalog_setup']; - $this->_resourceResolver->expects($this->any()) - ->method('getResourceList') - ->with('Test_Module') - ->will($this->returnValue($resourceList)); - + $this->_moduleListMock + ->expects($this->any()) + ->method('getNames') + ->will($this->returnValue(['Test_Module'])); + $this->_moduleListMock + ->expects($this->any()) + ->method('getOne') + ->will($this->returnValue(['setup_version' => '2.0.0'])); $this->_dbVersionInfo = $this->getMock('Magento\Framework\Module\DbVersionInfo', [], [], '', false); - $this->_model = new \Magento\Framework\Module\Updater( $this->_factoryMock, + $this->dataSetup, $this->_moduleListMock, - $this->_resourceResolver, $this->_dbVersionInfo ); } - public function testUpdateData() + public function testUpdateDataInstall() { - $this->_dbVersionInfo->expects($this->once()) + $this->_dbVersionInfo + ->expects($this->once()) ->method('isDataUpToDate') - ->with('Test_Module', 'catalog_setup') + ->with('Test_Module') ->will( $this->returnValue(false) ); - $this->_factoryMock->expects($this->any()) + $resource = $this->getMock('Magento\Framework\Module\Resource', [], [], '', false); + $resource + ->expects($this->once()) + ->method('getDataVersion') + ->will( + $this->returnValue(false) + ); + $this->_factoryMock + ->expects($this->once()) ->method('create') - ->with('catalog_setup', 'Test_Module') - ->will($this->returnValue($this->_resourceSetupMock)); - $this->_resourceSetupMock->expects($this->once()) - ->method('applyDataUpdates'); + ->with('Test_Module', 'install') + ->will($this->returnValue($this->getMock('Magento\Framework\Setup\InstallDataInterface'))); + $this->_model->updateData($resource); + } - $this->_model->updateData(); + public function testUpdateDataUpgrade() + { + $this->_dbVersionInfo + ->expects($this->once()) + ->method('isDataUpToDate') + ->with('Test_Module') + ->will( + $this->returnValue(false) + ); + $resource = $this->getMock('Magento\Framework\Module\Resource', [], [], '', false); + $resource + ->expects($this->once()) + ->method('getDataVersion') + ->will( + $this->returnValue(true) + ); + $this->_factoryMock + ->expects($this->once()) + ->method('create') + ->with('Test_Module', 'upgrade') + ->will($this->returnValue($this->getMock('Magento\Framework\Setup\UpgradeDataInterface'))); + $this->_model->updateData($resource); } public function testUpdateDataNoUpdates() { - $this->_dbVersionInfo->expects($this->once()) + $this->_dbVersionInfo + ->expects($this->once()) ->method('isDataUpToDate') - ->with('Test_Module', 'catalog_setup') - ->will($this->returnValue(true)); - $this->_factoryMock->expects($this->never()) - ->method('create'); - - $this->_model->updateData(); + ->with('Test_Module') + ->will( + $this->returnValue(true) + ); + $resource = $this->getMock('Magento\Framework\Module\Resource', [], [], '', false); + $this->_model->updateData($resource); } } diff --git a/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerFactoryTest.php b/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerFactoryTest.php index f7c4410566a3d..2f4b6460ae2e2 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerFactoryTest.php @@ -67,6 +67,14 @@ public function testCreate() 'Magento\Setup\Model\ObjectManagerFactory', $this->getMock('Magento\Setup\Model\ObjectManagerFactory', [], [], '', false), ], + [ + 'Magento\Framework\App\DeploymentConfig\Reader', + $this->getMock('Magento\Framework\App\DeploymentConfig\Reader', [], [], '', false), + ], + [ + 'Magento\Setup\Module\ModuleInstallerUpgraderFactory', + $this->getMock('Magento\Setup\Module\ModuleInstallerUpgraderFactory', [], [], '', false), + ], ]; $serviceLocatorMock = $this->getMockForAbstractClass('Zend\ServiceManager\ServiceLocatorInterface', ['get']); $serviceLocatorMock @@ -75,7 +83,12 @@ public function testCreate() ->will($this->returnValueMap($returnValueMap)); $log = $this->getMockForAbstractClass('Magento\Setup\Model\LoggerInterface'); - $installerFactory = new InstallerFactory($serviceLocatorMock); + $resourceFactoryMock = $this->getMock('Magento\Setup\Module\ResourceFactory', [], [], '', false); + $resourceFactoryMock + ->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->getMock('Magento\Framework\App\Resource', [], [], '', false))); + $installerFactory = new InstallerFactory($serviceLocatorMock, $resourceFactoryMock); $installer = $installerFactory->create($log); $this->assertInstanceOf('Magento\Setup\Model\Installer', $installer); } diff --git a/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php b/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php index 4445dbe0082ab..8e112960a3406 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php @@ -114,6 +114,16 @@ class InstallerTest extends \PHPUnit_Framework_TestCase ], ]; + /** + * @var \Magento\Framework\App\Resource|\PHPUnit_Framework_MockObject_MockObject + */ + private $resourceMock; + + /** + * @var \Magento\Setup\Module\ModuleInstallerUpgraderFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $updaterMock; + protected function setUp() { $this->filePermissions = $this->getMock('Magento\Setup\Model\FilePermissions', [], [], '', false); @@ -129,9 +139,6 @@ protected function setUp() $connection->expects($this->any())->method('newTable')->willReturn($table); $this->setupFactory = $this->getMock('Magento\Setup\Module\SetupFactory', [], [], '', false); - $this->setupFactory->expects($this->any())->method('createSetupModule')->willReturn( - $this->getMock('Magento\Setup\Module\SetupModule', [], [], '', false) - ); $this->setupFactory->expects($this->any())->method('createSetup')->willReturn($setup); $this->moduleList = $this->getMockForAbstractClass('Magento\Framework\Module\ModuleListInterface'); @@ -153,6 +160,8 @@ protected function setUp() $this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); $this->sampleData = $this->getMock('Magento\Setup\Model\SampleData', [], [], '', false); $this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface'); + $this->resourceMock = $this->getMock('Magento\Framework\App\Resource', [], [], '', false); + $this->updaterMock = $this->getMock('Magento\Setup\Module\ModuleInstallerUpgraderFactory', [], [], '', false); $this->object = $this->createObject(); } @@ -188,7 +197,9 @@ private function createObject($connectionFactory = false, $objectManagerFactory $this->maintenanceMode, $this->filesystem, $this->sampleData, - $objectManagerFactory + $objectManagerFactory, + $this->resourceMock, + $this->updaterMock ); } @@ -230,16 +241,13 @@ public function testInstall() $this->logger->expects($this->at(7))->method('log')->with('Installing database schema:'); $this->logger->expects($this->at(9))->method('log')->with("Module 'Foo_One':"); $this->logger->expects($this->at(11))->method('log')->with("Module 'Bar_Two':"); - $this->logger->expects($this->at(13))->method('log')->with('Schema post-updates:'); - $this->logger->expects($this->at(14))->method('log')->with("Module 'Foo_One':"); - $this->logger->expects($this->at(15))->method('log')->with("Module 'Bar_Two':"); - $this->logger->expects($this->at(17))->method('log')->with('Installing user configuration...'); - $this->logger->expects($this->at(19))->method('log')->with('Installing data...'); - $this->logger->expects($this->at(21))->method('log')->with('Installing admin user...'); - $this->logger->expects($this->at(23))->method('log')->with('Enabling caches:'); - $this->logger->expects($this->at(24))->method('log')->with('Current status:'); - $this->logger->expects($this->at(27))->method('log')->with('Disabling Maintenance Mode:'); - $this->logger->expects($this->at(29))->method('log')->with('Post installation file permissions check...'); + $this->logger->expects($this->at(14))->method('log')->with('Installing user configuration...'); + $this->logger->expects($this->at(16))->method('log')->with('Installing data...'); + $this->logger->expects($this->at(18))->method('log')->with('Installing admin user...'); + $this->logger->expects($this->at(20))->method('log')->with('Enabling caches:'); + $this->logger->expects($this->at(21))->method('log')->with('Current status:'); + $this->logger->expects($this->at(24))->method('log')->with('Disabling Maintenance Mode:'); + $this->logger->expects($this->at(26))->method('log')->with('Post installation file permissions check...'); $this->logger->expects($this->once())->method('logSuccess')->with('Magento installation complete.'); $this->object->install($request); } diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/ModuleInstallerUpgraderFactoryTest.php b/dev/tests/unit/testsuite/Magento/Setup/Module/ModuleInstallerUpgraderFactoryTest.php new file mode 100644 index 0000000000000..63a7cc070f723 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Setup/Module/ModuleInstallerUpgraderFactoryTest.php @@ -0,0 +1,56 @@ +getMockForAbstractClass('Magento\Framework\Setup\InstallSchemaInterface'), + ], + [ + 'Bar\Two\Setup\UpgradeSchema', + $this->getMockForAbstractClass('Magento\Framework\Setup\UpgradeSchemaInterface'), + ], + ]; + + $serviceLocatorMock = $this->getMockForAbstractClass('Zend\ServiceManager\ServiceLocatorInterface', ['get']); + $serviceLocatorMock + ->expects($this->any()) + ->method('get') + ->will($this->returnValueMap($returnValueMap)); + $directoryListMock = $this->getMock('Magento\Framework\App\Filesystem\DirectoryList', [], [], '', false); + $directoryListMock + ->expects($this->exactly(2)) + ->method('getPath') + ->will($this->returnValue(__DIR__ . '/_files')); + $this->moduleInstallerUpgraderFactory = new ModuleInstallerUpgraderFactory( + $serviceLocatorMock, + $directoryListMock + ); + } + + public function testCreateSchemaInstaller() + { + $installer = $this->moduleInstallerUpgraderFactory->createSchemaInstaller('Foo_One'); + $this->assertInstanceOf('Magento\Framework\Setup\InstallSchemaInterface', $installer); + } + + public function testCreateSchemaUpgrader() + { + $upgrader = $this->moduleInstallerUpgraderFactory->createSchemaUpgrader('Bar_Two'); + $this->assertInstanceOf('Magento\Framework\Setup\UpgradeSchemaInterface', $upgrader); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/Setup/FileResolverTest.php b/dev/tests/unit/testsuite/Magento/Setup/Module/Setup/FileResolverTest.php deleted file mode 100644 index 89a7ad5db818f..0000000000000 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/Setup/FileResolverTest.php +++ /dev/null @@ -1,69 +0,0 @@ -directoryListMock = $this->getMock('Magento\Framework\App\Filesystem\DirectoryList', [], [], '', false); - $this->fileResolver = new FileResolver($this->directoryListMock); - } - - public function testGetSqlSetupFiles() - { - $this->directoryListMock - ->expects($this->exactly(4)) - ->method('getPath') - ->will($this->returnValue(__DIR__ . '/../_files')); - - // All valid data - $this->assertGreaterThan(0, count($this->fileResolver->getSqlSetupFiles('Magento_Module1', '*.php'))); - - // Valid module name with default filename pattern - $this->assertGreaterThan(0, count($this->fileResolver->getSqlSetupFiles('Magento_Module1'))); - - // Invalid module name - $this->assertCount(0, $this->fileResolver->getSqlSetupFiles('Magento_Module5', '*.php')); - - // Invalid filename pattern for SQL files - $this->assertCount(0, $this->fileResolver->getSqlSetupFiles('Magento_Module1', '*.text')); - } - - public function testGetResourceCode() - { - $this->directoryListMock - ->expects($this->exactly(10)) - ->method('getPath') - ->will($this->returnValue(__DIR__ . '/../_files')); - - // Valid module name with both 'data' and 'sql' directories - $this->assertSame('module1_setup', $this->fileResolver->getResourceCode('Magento_Module1')); - - // Valid module name with only 'sql' directories (no 'data') - $this->assertSame('module2_setup', $this->fileResolver->getResourceCode('Magento_Module2')); - - // Valid module name with only 'data' directories (no 'sql') - $this->assertSame('module3_setup', $this->fileResolver->getResourceCode('Magento_Module3')); - - // Valid module name with no 'data' and 'sql' directories - $this->assertNull($this->fileResolver->getResourceCode('Magento_Module4')); - - // Invalid module name - $this->assertNull($this->fileResolver->getResourceCode('Magento_Module5')); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php b/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php index 599f926fd5920..a44164de463ee 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Module/SetupFactoryTest.php @@ -15,46 +15,14 @@ class SetupFactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $returnValueMap = [ - [ - 'Magento\Framework\Module\ModuleList', - $this->getMock('Magento\Framework\Module\ModuleList', [], [], '', false), - ], - [ - 'Magento\Setup\Module\Setup\FileResolver', - $this->getMock('Magento\Setup\Module\Setup\FileResolver', [], [], '', false), - ], - [ - 'Magento\Framework\App\DeploymentConfig\Reader', - $this->getMock('Magento\Framework\App\DeploymentConfig\Reader', [], [], '', false), - ], - ]; - $serviceLocatorMock = $this->getMockForAbstractClass('Zend\ServiceManager\ServiceLocatorInterface', ['get']); - $serviceLocatorMock - ->expects($this->any()) - ->method('get') - ->will($this->returnValueMap($returnValueMap)); - $resourceFactory = $this->getMock('Magento\Setup\Module\ResourceFactory', [], [], '', false); - $resourceFactory - ->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->getMock('Magento\Framework\App\Resource', [], [], '', false))); - $this->setupFactory = new SetupFactory($serviceLocatorMock, $resourceFactory); + $this->setupFactory = new SetupFactory($serviceLocatorMock); } public function testCreateSetup() { - $setup = $this->setupFactory->createSetup(); + $resourceMock = $this->getMock('Magento\Framework\App\Resource', [], [], '', false); + $setup = $this->setupFactory->createSetup($resourceMock); $this->assertInstanceOf('Magento\Setup\Module\Setup', $setup); } - - public function testCreateSetupModule() - { - $setupModule = $this->setupFactory->createSetupModule( - $this->getMockForAbstractClass('Magento\Setup\Model\LoggerInterface'), - 'sampleModuleName' - ); - $this->assertInstanceOf('Magento\Framework\Setup\ModuleSchemaSetupInterface', $setupModule); - } } diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/SetupModuleTest.php b/dev/tests/unit/testsuite/Magento/Setup/Module/SetupModuleTest.php deleted file mode 100644 index 57379f400c499..0000000000000 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/SetupModuleTest.php +++ /dev/null @@ -1,124 +0,0 @@ -loggerMock = $this->getMockForAbstractClass('Magento\Setup\Model\LoggerInterface'); - $this->moduleListMock = $this->getMockForAbstractClass('Magento\Framework\Module\ModuleListInterface'); - $this->moduleName = 'SampleModule'; - $this->moduleListMock - ->expects($this->once()) - ->method('getOne') - ->with($this->moduleName) - ->will($this->returnValue(['name' => 'SampleModule', 'setup_version' => '2.0.0'])); - $this->resourceModelMock = $this->getMock('Magento\Framework\App\Resource', [], [], '', false); - } - - public function testApplyRecurringUpdatesWithValidFile() - { - $fileResolver = $this->getMock('Magento\Setup\Module\Setup\FileResolver', [], [], '', false); - $fileResolver - ->expects($this->once()) - ->method('getSqlSetupFiles') - ->with($this->moduleName, 'recurring.php') - ->will($this->returnValue([__DIR__ . '/_files/recurring.php'])); - $this->loggerMock - ->expects($this->once()) - ->method('log'); - $setupModule = new SetupModule( - $this->loggerMock, - $this->moduleListMock, - $fileResolver, - $this->moduleName, - $this->resourceModelMock - ); - $setupModule = $setupModule->applyRecurringUpdates(); - $this->assertInstanceOf('Magento\Setup\Module\SetupModule', $setupModule); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessageRegExp #Error in file: *# - */ - public function testApplyRecurringUpdatesWithInvalidFile() - { - $fileResolver = $this->getMock('Magento\Setup\Module\Setup\FileResolver', [], [], '', false); - $fileResolver - ->expects($this->once()) - ->method('getSqlSetupFiles') - ->with($this->moduleName, 'recurring.php') - ->will($this->returnValue([__DIR__ . '/_files/recurring1.php'])); - $this->loggerMock - ->expects($this->once()) - ->method('log'); - $setupModule = new SetupModule( - $this->loggerMock, - $this->moduleListMock, - $fileResolver, - $this->moduleName, - $this->resourceModelMock - ); - $setupModule->applyRecurringUpdates(); - } - - public function testApplyUpdatesWithNullResource() - { - $fileResolver = $this->getMock('Magento\Setup\Module\Setup\FileResolver', [], [], '', false); - $fileResolver - ->expects($this->once()) - ->method('getResourceCode') - ->will($this->returnValue(null)); - $setupModule = new SetupModule( - $this->loggerMock, - $this->moduleListMock, - $fileResolver, - $this->moduleName, - $this->resourceModelMock - ); - $setupModule = $setupModule->applyUpdates(); - $this->assertInstanceOf('Magento\Setup\Module\SetupModule', $setupModule); - } - - public function testApplyUpdatesWithNoVersions() - { - $fileResolver = $this->getMock('Magento\Setup\Module\Setup\FileResolver', [], [], '', false); - $setupModule = new SetupModule( - $this->loggerMock, - $this->moduleListMock, - $fileResolver, - $this->moduleName, - $this->resourceModelMock - ); - $setupModule = $setupModule->applyUpdates(); - $this->assertInstanceOf('Magento\Setup\Module\SetupModule', $setupModule); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module1/data/module1_setup/data-install.php b/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Bar/Two/Setup/UpgradeSchema.php similarity index 96% rename from dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module1/data/module1_setup/data-install.php rename to dev/tests/unit/testsuite/Magento/Setup/Module/_files/Bar/Two/Setup/UpgradeSchema.php index 25f63440e1a2d..da576e1679422 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module1/data/module1_setup/data-install.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Bar/Two/Setup/UpgradeSchema.php @@ -2,4 +2,4 @@ /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. - */ + */ \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module1/sql/module1_setup/install.php b/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Foo/One/Setup/InstallSchema.php similarity index 96% rename from dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module1/sql/module1_setup/install.php rename to dev/tests/unit/testsuite/Magento/Setup/Module/_files/Foo/One/Setup/InstallSchema.php index 25f63440e1a2d..da576e1679422 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Magento/Module1/sql/module1_setup/install.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Foo/One/Setup/InstallSchema.php @@ -2,4 +2,4 @@ /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. - */ + */ \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/recurring.php b/dev/tests/unit/testsuite/Magento/Setup/Module/_files/recurring.php deleted file mode 100644 index 25f63440e1a2d..0000000000000 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/recurring.php +++ /dev/null @@ -1,5 +0,0 @@ -directoryList->getPath(DirectoryList::MODULES) . '/' . $modulePath . '/Setup/InstallData'; @@ -67,6 +67,7 @@ private function getInstallerUpgrader($path) '', $path )); + $temp = $this->_objectManager->create($path); return $this->_objectManager->create($path); } else { return null; From 47a3d4933269653162fccc7413d32960ef48a6dc Mon Sep 17 00:00:00 2001 From: Safwan Khan Date: Tue, 17 Feb 2015 19:14:09 -0600 Subject: [PATCH 048/106] MAGETWO-33888: Change setup framework to use SPI classes - Changed logic to deal null values in setup_module table. --- lib/internal/Magento/Framework/Module/Updater.php | 2 +- setup/src/Magento/Setup/Model/Installer.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/Updater.php b/lib/internal/Magento/Framework/Module/Updater.php index 1b21a2d17fe81..90f570f2a16c0 100644 --- a/lib/internal/Magento/Framework/Module/Updater.php +++ b/lib/internal/Magento/Framework/Module/Updater.php @@ -76,8 +76,8 @@ public function updateData($resource) $moduleInstaller = $this->setupFactory->create($moduleName, 'install'); if ($moduleInstaller) { $moduleInstaller->install($this->dataSetup, $moduleContext); - $resource->setDataVersion($moduleName, $configVer); } + $resource->setDataVersion($moduleName, $configVer); } } } diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 4f8b5bf36485c..e9e306af51505 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -626,8 +626,8 @@ public function installSchema() $moduleInstaller = $this->moduleInstallerUpgraderFactory->createSchemaInstaller($moduleName); if ($moduleInstaller) { $moduleInstaller->install($this->setup, $moduleContext); - $this->resource->setDbVersion($moduleName, $configVer); } + $this->resource->setDbVersion($moduleName, $configVer); } $this->logProgress(); } From d32a1e89faf280550014c60dcd499be8ede5c607 Mon Sep 17 00:00:00 2001 From: Safwan Khan Date: Wed, 18 Feb 2015 09:56:20 -0600 Subject: [PATCH 049/106] MAGETWO-33888: Change setup framework to use SPI classes - Corrected DataSetupTest. --- .../Magento/Setup/Module/DataSetupTest.php | 30 +------------------ 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php index 071ee6f899500..77aa30acf4167 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php @@ -17,35 +17,7 @@ class DataSetupTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Setup\Module\DataSetup', - ['resourceName' => 'default_setup', 'moduleName' => 'Magento_Core'] - ); - } - - public function testApplyAllDataUpdates() - { - /* reset data version */ - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Framework\Module\ResourceInterface' - )->setDataVersion( - 'adminnotification_setup', - false - ); - /* clear table */ - $this->_model->getConnection()->delete($this->_model->getTable('adminnotification_inbox'), 'true'); - $this->_model->getConnection()->delete($this->_model->getTable('admin_system_messages'), 'true'); - /** @var $updater \Magento\Framework\Module\Updater */ - $updater = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\Module\Updater'); - try { - $updater->updateData(); - } catch (\Exception $e) { - $this->fail("Impossible to continue other tests, because database is broken: {$e}"); - } - $this->assertNotEmpty( - $this->_model->getTableRow('setup_module', 'module', 'Magento_AdminNotification', 'schema_version') - ); - $this->assertNotEmpty( - $this->_model->getTableRow('setup_module', 'module', 'Magento_AdminNotification', 'data_version') + 'Magento\Setup\Module\DataSetup' ); } From 2d65718e461ddaaef05bf14708f8025a5dfa82bc Mon Sep 17 00:00:00 2001 From: Maddy Chellathurai Date: Wed, 18 Feb 2015 10:55:26 -0600 Subject: [PATCH 050/106] MAGETWO-33889: Convert CE schema and data scripts to SPI classes - CR related phpcs changes. --- .../AdminNotification/Setup/InstallSchema.php | 220 +- .../Authorization/Setup/InstallSchema.php | 275 +- .../Magento/Bundle/Setup/InstallSchema.php | 2045 +-- .../Magento/Captcha/Setup/InstallSchema.php | 95 +- .../Magento/Catalog/Setup/InstallSchema.php | 9217 +++++++------- .../Magento/Catalog/Setup/UpgradeSchema.php | 21 +- .../CatalogInventory/Setup/InstallSchema.php | 893 +- .../CatalogRule/Setup/InstallSchema.php | 1041 +- .../CatalogSearch/Setup/InstallSchema.php | 151 +- .../CatalogUrlRewrite/Setup/InstallSchema.php | 143 +- .../Setup/InstallSchema.php | 207 +- app/code/Magento/Cms/Setup/InstallSchema.php | 535 +- .../Setup/InstallSchema.php | 619 +- .../Setup/UpgradeSchema.php | 25 +- app/code/Magento/Core/Setup/InstallSchema.php | 959 +- app/code/Magento/Cron/Setup/InstallSchema.php | 161 +- .../Magento/Customer/Setup/InstallSchema.php | 18 +- .../Magento/Customer/Setup/UpgradeSchema.php | 6 +- .../DesignEditor/Setup/InstallSchema.php | 107 +- .../Magento/Directory/Setup/InstallSchema.php | 389 +- .../Downloadable/Setup/InstallSchema.php | 1433 +-- app/code/Magento/Eav/Setup/InstallSchema.php | 2881 ++--- .../Magento/Email/Setup/InstallSchema.php | 219 +- .../GiftMessage/Setup/InstallSchema.php | 113 +- .../GoogleOptimizer/Setup/InstallSchema.php | 153 +- .../GoogleShopping/Setup/InstallSchema.php | 371 +- .../ImportExport/Setup/InstallSchema.php | 103 +- .../Magento/Indexer/Setup/InstallSchema.php | 239 +- .../Integration/Setup/InstallSchema.php | 717 +- app/code/Magento/Log/Setup/InstallSchema.php | 783 +- .../Newsletter/Setup/InstallSchema.php | 923 +- .../OfflineShipping/Setup/InstallSchema.php | 259 +- .../Persistent/Setup/InstallSchema.php | 201 +- .../ProductAlert/Setup/InstallSchema.php | 395 +- .../Magento/Quote/Setup/InstallSchema.php | 3077 +++-- .../Magento/Reports/Setup/InstallSchema.php | 1739 +-- .../Magento/Review/Setup/InstallSchema.php | 1509 ++- .../Magento/Sales/Setup/InstallSchema.php | 10339 ++++++++-------- .../Magento/Sales/Setup/UpgradeSchema.php | 21 +- .../Magento/SalesRule/Setup/InstallSchema.php | 1579 +-- .../Magento/Search/Setup/InstallSchema.php | 243 +- .../Sendfriend/Setup/InstallSchema.php | 107 +- .../Magento/Sitemap/Setup/InstallSchema.php | 147 +- .../Magento/Store/Setup/InstallSchema.php | 566 +- app/code/Magento/Tax/Setup/InstallSchema.php | 1009 +- .../Magento/Theme/Setup/InstallSchema.php | 297 +- .../Magento/Theme/Setup/UpgradeSchema.php | 21 +- .../Translation/Setup/InstallSchema.php | 187 +- .../UrlRewrite/Setup/InstallSchema.php | 223 +- app/code/Magento/User/Setup/InstallSchema.php | 263 +- app/code/Magento/Weee/Setup/InstallSchema.php | 223 +- app/code/Magento/Weee/Setup/UpgradeSchema.php | 21 +- .../Magento/Widget/Setup/InstallSchema.php | 565 +- .../Magento/Wishlist/Setup/InstallSchema.php | 402 +- 54 files changed, 24279 insertions(+), 24176 deletions(-) diff --git a/app/code/Magento/AdminNotification/Setup/InstallSchema.php b/app/code/Magento/AdminNotification/Setup/InstallSchema.php index 7ecba3ea31e06..462700c106661 100644 --- a/app/code/Magento/AdminNotification/Setup/InstallSchema.php +++ b/app/code/Magento/AdminNotification/Setup/InstallSchema.php @@ -1,10 +1,8 @@ startSetup(); - /** - * Create table 'adminnotification_inbox' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('adminnotification_inbox') - )->addColumn( - 'notification_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Notification id' - )->addColumn( - 'severity', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Problem type' - )->addColumn( - 'date_added', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Create date' - )->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Title' - )->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - )->addColumn( - 'url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Url' - )->addColumn( - 'is_read', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Flag if notification read' - )->addColumn( - 'is_remove', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Flag if notification might be removed' - )->addIndex( - $installer->getIdxName('adminnotification_inbox', ['severity']), - ['severity'] - )->addIndex( - $installer->getIdxName('adminnotification_inbox', ['is_read']), - ['is_read'] - )->addIndex( - $installer->getIdxName('adminnotification_inbox', ['is_remove']), - ['is_remove'] - )->setComment( - 'Adminnotification Inbox' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'admin_system_messages' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('admin_system_messages') - )->addColumn( - 'identity', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['nullable' => false, 'primary' => true], - 'Message id' - )->addColumn( - 'severity', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Problem type' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Create date' - )->setComment( - 'Admin System Messages' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + /** + * Create table 'adminnotification_inbox' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('adminnotification_inbox') + )->addColumn( + 'notification_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Notification id' + )->addColumn( + 'severity', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Problem type' + )->addColumn( + 'date_added', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Create date' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Title' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Url' + )->addColumn( + 'is_read', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Flag if notification read' + )->addColumn( + 'is_remove', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Flag if notification might be removed' + )->addIndex( + $installer->getIdxName('adminnotification_inbox', ['severity']), + ['severity'] + )->addIndex( + $installer->getIdxName('adminnotification_inbox', ['is_read']), + ['is_read'] + )->addIndex( + $installer->getIdxName('adminnotification_inbox', ['is_remove']), + ['is_remove'] + )->setComment( + 'Adminnotification Inbox' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'admin_system_messages' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('admin_system_messages') + )->addColumn( + 'identity', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['nullable' => false, 'primary' => true], + 'Message id' + )->addColumn( + 'severity', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Problem type' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Create date' + )->setComment( + 'Admin System Messages' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Authorization/Setup/InstallSchema.php b/app/code/Magento/Authorization/Setup/InstallSchema.php index 2c57b529b80f4..4dce4c8970fdf 100644 --- a/app/code/Magento/Authorization/Setup/InstallSchema.php +++ b/app/code/Magento/Authorization/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_role'))) { - /** - * Create table 'authorization_role' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('authorization_role') - )->addColumn( - 'role_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Role ID' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Parent Role ID' - )->addColumn( - 'tree_level', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Role Tree Level' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Role Sort Order' - )->addColumn( - 'role_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 1, - ['nullable' => false, 'default' => '0'], - 'Role Type' - )->addColumn( - 'user_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'User ID' - )->addColumn( - 'user_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['nullable' => true, 'default' => null], - 'User Type' - )->addColumn( - 'role_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => true, 'default' => null], - 'Role Name' - )->addIndex( - $installer->getIdxName('authorization_role', ['parent_id', 'sort_order']), - ['parent_id', 'sort_order'] - )->addIndex( - $installer->getIdxName('authorization_role', ['tree_level']), - ['tree_level'] - )->setComment( - 'Admin Role Table' - ); - $installer->getConnection()->createTable($table); - } - - if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_rule'))) { - /** - * Create table 'authorization_rule' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('authorization_rule') - )->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule ID' - )->addColumn( - 'role_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Role ID' - )->addColumn( - 'resource_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Resource ID' - )->addColumn( - 'privileges', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - ['nullable' => true], - 'Privileges' - )->addColumn( - 'permission', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 10, - [], - 'Permission' - )->addIndex( - $installer->getIdxName('authorization_rule', ['resource_id', 'role_id']), - ['resource_id', 'role_id'] - )->addIndex( - $installer->getIdxName('authorization_rule', ['role_id', 'resource_id']), - ['role_id', 'resource_id'] - )->addForeignKey( - $installer->getFkName('authorization_rule', 'role_id', 'authorization_role', 'role_id'), - 'role_id', - $installer->getTable('authorization_role'), - 'role_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Admin Rule Table' - ); - $installer->getConnection()->createTable($table); - } - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_role'))) { + /** + * Create table 'authorization_role' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('authorization_role') + )->addColumn( + 'role_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Role ID' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Parent Role ID' + )->addColumn( + 'tree_level', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Role Tree Level' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Role Sort Order' + )->addColumn( + 'role_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 1, + ['nullable' => false, 'default' => '0'], + 'Role Type' + )->addColumn( + 'user_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'User ID' + )->addColumn( + 'user_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['nullable' => true, 'default' => null], + 'User Type' + )->addColumn( + 'role_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => true, 'default' => null], + 'Role Name' + )->addIndex( + $installer->getIdxName('authorization_role', ['parent_id', 'sort_order']), + ['parent_id', 'sort_order'] + )->addIndex( + $installer->getIdxName('authorization_role', ['tree_level']), + ['tree_level'] + )->setComment( + 'Admin Role Table' + ); + $installer->getConnection()->createTable($table); + } + + if (!$installer->getConnection()->isTableExists($installer->getTable('authorization_rule'))) { + /** + * Create table 'authorization_rule' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('authorization_rule') + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule ID' + )->addColumn( + 'role_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Role ID' + )->addColumn( + 'resource_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Resource ID' + )->addColumn( + 'privileges', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + ['nullable' => true], + 'Privileges' + )->addColumn( + 'permission', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 10, + [], + 'Permission' + )->addIndex( + $installer->getIdxName('authorization_rule', ['resource_id', 'role_id']), + ['resource_id', 'role_id'] + )->addIndex( + $installer->getIdxName('authorization_rule', ['role_id', 'resource_id']), + ['role_id', 'resource_id'] + )->addForeignKey( + $installer->getFkName('authorization_rule', 'role_id', 'authorization_role', 'role_id'), + 'role_id', + $installer->getTable('authorization_role'), + 'role_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Admin Rule Table' + ); + $installer->getConnection()->createTable($table); + } + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php index b2312ae5f2d1f..fedbefcfb3ced 100644 --- a/app/code/Magento/Bundle/Setup/InstallSchema.php +++ b/app/code/Magento/Bundle/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'catalog_product_bundle_option' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_bundle_option')) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Id' - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - ) - ->addColumn( - 'required', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Required' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Position' - ) - ->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Type' - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_option', ['parent_id']), - ['parent_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_bundle_option', 'parent_id', 'catalog_product_entity', 'entity_id'), - 'parent_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Bundle Option'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_bundle_option_value' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_bundle_option_value')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Option Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Title' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_bundle_option_value', - ['option_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['option_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_bundle_option_value', - 'option_id', - 'catalog_product_bundle_option', - 'option_id' - ), - 'option_id', - $installer->getTable('catalog_product_bundle_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Bundle Option Value'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_bundle_selection' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_bundle_selection')) - ->addColumn( - 'selection_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Selection Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Option Id' - ) - ->addColumn( - 'parent_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Product Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Product Id' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Position' - ) - ->addColumn( - 'is_default', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Default' - ) - ->addColumn( - 'selection_price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Selection Price Type' - ) - ->addColumn( - 'selection_price_value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Selection Price Value' - ) - ->addColumn( - 'selection_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Selection Qty' - ) - ->addColumn( - 'selection_can_change_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Selection Can Change Qty' - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_selection', ['option_id']), - ['option_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_selection', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_bundle_selection', - 'option_id', - 'catalog_product_bundle_option', - 'option_id' - ), - 'option_id', - $installer->getTable('catalog_product_bundle_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_bundle_selection', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Bundle Selection'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_bundle_selection_price' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_bundle_selection_price')) - ->addColumn( - 'selection_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Selection Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'selection_price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Selection Price Type' - ) - ->addColumn( - 'selection_price_value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Selection Price Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_selection_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_bundle_selection_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_bundle_selection_price', - 'selection_id', - 'catalog_product_bundle_selection', - 'selection_id' - ), - 'selection_id', - $installer->getTable('catalog_product_bundle_selection'), - 'selection_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Bundle Selection Price'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_bundle_price_index' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_bundle_price_index')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Max Price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_price_index', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_bundle_price_index', ['customer_group_id']), - ['customer_group_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_bundle_price_index', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_bundle_price_index', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_bundle_price_index', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Bundle Price Index'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_bundle_stock_index' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_bundle_stock_index') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Stock Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option Id' - ) - ->addColumn( - 'stock_status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['default' => '0'], - 'Stock Status' - ) - ->setComment('Catalog Product Bundle Stock Index'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_index_price_bundle_idx' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_idx')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class Id' - ) - ->addColumn( - 'price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Price Type' - ) - ->addColumn( - 'special_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Special Price' - ) - ->addColumn( - 'tier_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Percent' - ) - ->addColumn( - 'orig_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Orig Price' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'base_tier', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tier' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) - ->addColumn( - 'group_price_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group Price Percent' - ) - ->setComment('Catalog Product Index Price Bundle Idx'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_index_price_bundle_tmp' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_tmp')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class Id' - ) - ->addColumn( - 'price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Price Type' - ) - ->addColumn( - 'special_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Special Price' - ) - ->addColumn( - 'tier_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Percent' - ) - ->addColumn( - 'orig_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Orig Price' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'base_tier', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tier' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) - ->addColumn( - 'group_price_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group Price Percent' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment('Catalog Product Index Price Bundle Tmp'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_index_price_bundle_sel_idx' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_sel_idx')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option Id' - ) - ->addColumn( - 'selection_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Selection Id' - ) - ->addColumn( - 'group_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Group Type' - ) - ->addColumn( - 'is_required', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Is Required' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setComment('Catalog Product Index Price Bundle Sel Idx'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_index_price_bundle_sel_tmp' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_sel_tmp')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option Id' - ) - ->addColumn( - 'selection_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Selection Id' - ) - ->addColumn( - 'group_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Group Type' - ) - ->addColumn( - 'is_required', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Is Required' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment('Catalog Product Index Price Bundle Sel Tmp'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_index_price_bundle_opt_idx' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_opt_idx')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option Id' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'alt_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'alt_tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'alt_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Group Price' - ) - ->setComment('Catalog Product Index Price Bundle Opt Idx'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_index_price_bundle_opt_tmp' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_bundle_opt_tmp')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option Id' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'alt_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'alt_tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'alt_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Alt Group Price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment('Catalog Product Index Price Bundle Opt Tmp'); - - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'catalog_product_bundle_option' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_bundle_option')) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Id' + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + ) + ->addColumn( + 'required', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Required' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Type' + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_option', ['parent_id']), + ['parent_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_bundle_option', + 'parent_id', + 'catalog_product_entity', + 'entity_id' + ), + 'parent_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Bundle Option'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_bundle_option_value' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_bundle_option_value')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Option Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_bundle_option_value', + ['option_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_bundle_option_value', + 'option_id', + 'catalog_product_bundle_option', + 'option_id' + ), + 'option_id', + $installer->getTable('catalog_product_bundle_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Bundle Option Value'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_bundle_selection' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_bundle_selection')) + ->addColumn( + 'selection_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Selection Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Option Id' + ) + ->addColumn( + 'parent_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Product Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Product Id' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'is_default', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Default' + ) + ->addColumn( + 'selection_price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Selection Price Type' + ) + ->addColumn( + 'selection_price_value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Selection Price Value' + ) + ->addColumn( + 'selection_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Selection Qty' + ) + ->addColumn( + 'selection_can_change_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Selection Can Change Qty' + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_selection', ['option_id']), + ['option_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_selection', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_bundle_selection', + 'option_id', + 'catalog_product_bundle_option', + 'option_id' + ), + 'option_id', + $installer->getTable('catalog_product_bundle_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_bundle_selection', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Bundle Selection'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_bundle_selection_price' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_bundle_selection_price')) + ->addColumn( + 'selection_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Selection Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'selection_price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Selection Price Type' + ) + ->addColumn( + 'selection_price_value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Selection Price Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_selection_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_bundle_selection_price', + 'website_id', + 'store_website', + 'website_id' + ), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_bundle_selection_price', + 'selection_id', + 'catalog_product_bundle_selection', + 'selection_id' + ), + 'selection_id', + $installer->getTable('catalog_product_bundle_selection'), + 'selection_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Bundle Selection Price'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_bundle_price_index' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_bundle_price_index')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Max Price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_price_index', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_bundle_price_index', ['customer_group_id']), + ['customer_group_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_bundle_price_index', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_bundle_price_index', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_bundle_price_index', + 'website_id', + 'store_website', + 'website_id' + ), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Bundle Price Index'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_bundle_stock_index' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_bundle_stock_index') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Stock Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option Id' + ) + ->addColumn( + 'stock_status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['default' => '0'], + 'Stock Status' + ) + ->setComment('Catalog Product Bundle Stock Index'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_idx' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_idx')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class Id' + ) + ->addColumn( + 'price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Price Type' + ) + ->addColumn( + 'special_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Special Price' + ) + ->addColumn( + 'tier_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Percent' + ) + ->addColumn( + 'orig_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Orig Price' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'base_tier', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tier' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'base_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Group Price' + ) + ->addColumn( + 'group_price_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group Price Percent' + ) + ->setComment('Catalog Product Index Price Bundle Idx'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_tmp' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_tmp')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class Id' + ) + ->addColumn( + 'price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Price Type' + ) + ->addColumn( + 'special_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Special Price' + ) + ->addColumn( + 'tier_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Percent' + ) + ->addColumn( + 'orig_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Orig Price' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'base_tier', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tier' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'base_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Group Price' + ) + ->addColumn( + 'group_price_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group Price Percent' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment('Catalog Product Index Price Bundle Tmp'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_sel_idx' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_sel_idx')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option Id' + ) + ->addColumn( + 'selection_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Selection Id' + ) + ->addColumn( + 'group_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Group Type' + ) + ->addColumn( + 'is_required', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Is Required' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment('Catalog Product Index Price Bundle Sel Idx'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_sel_tmp' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_sel_tmp')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option Id' + ) + ->addColumn( + 'selection_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Selection Id' + ) + ->addColumn( + 'group_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Group Type' + ) + ->addColumn( + 'is_required', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Is Required' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment('Catalog Product Index Price Bundle Sel Tmp'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_opt_idx' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_opt_idx')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option Id' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'alt_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'alt_tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'alt_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Group Price' + ) + ->setComment('Catalog Product Index Price Bundle Opt Idx'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_bundle_opt_tmp' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_bundle_opt_tmp')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option Id' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'alt_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'alt_tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'alt_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Alt Group Price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment('Catalog Product Index Price Bundle Opt Tmp'); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Captcha/Setup/InstallSchema.php b/app/code/Magento/Captcha/Setup/InstallSchema.php index 40a0d009bba14..b4da3f6cc9fb4 100644 --- a/app/code/Magento/Captcha/Setup/InstallSchema.php +++ b/app/code/Magento/Captcha/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - $table = $installer->getConnection()->newTable( - $installer->getTable('captcha_log') - )->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Type' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'unsigned' => true, 'primary' => true], - 'Value' - )->addColumn( - 'count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Count' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Update Time' - )->setComment( - 'Count Login Attempts' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + $table = $installer->getConnection()->newTable( + $installer->getTable('captcha_log') + )->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Type' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'unsigned' => true, 'primary' => true], + 'Value' + )->addColumn( + 'count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Count' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Update Time' + )->setComment( + 'Count Login Attempts' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php index 01340fa4f67dd..acf5e12f3ea6f 100644 --- a/app/code/Magento/Catalog/Setup/InstallSchema.php +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'catalog_product_entity' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'default' => 'simple'], - 'Type ID' - ) - ->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - [], - 'SKU' - ) - ->addColumn( - 'has_options', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Has Options' - ) - ->addColumn( - 'required_options', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Required Options' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Creation Time' - ) - ->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - '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'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity', ['sku']), - ['sku'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), - 'attribute_set_id', - $installer->getTable('eav_attribute_set'), - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_entity_datetime' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_datetime')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_datetime', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_datetime', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_datetime', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Datetime Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_entity_decimal' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_decimal')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_decimal', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_decimal', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_decimal', ['attribute_id']), - ['attribute_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Decimal Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_entity_int' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_int')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_int', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_int', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_int', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_int', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_int', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Integer Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_entity_text' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_text')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_text', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_text', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_text', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_text', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_text', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Text Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_entity_varchar' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_varchar')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_varchar', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_varchar', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_varchar', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Varchar Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_entity_gallery' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_entity_gallery')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Position' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_gallery', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_gallery', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_gallery', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_gallery', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Gallery Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_category_entity' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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'], - 'Attriute Set ID' - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Parent Category ID' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Creation Time' - ) - ->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Update Time' - ) - ->addColumn( - 'path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Tree Path' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Position' - ) - ->addColumn( - 'level', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Tree Level' - ) - ->addColumn( - 'children_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Child Count' - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity', ['level']), - ['level'] - ) - ->setComment('Catalog Category Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_category_entity_datetime' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity_datetime')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_entity_datetime', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_datetime', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_datetime', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_datetime', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Category Datetime Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_category_entity_decimal' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity_decimal')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_entity_decimal', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_decimal', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_decimal', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_decimal', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Category Decimal Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_category_entity_int' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity_int')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_entity_int', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_int', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_int', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_int', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_int', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_int', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Category Integer Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_category_entity_text' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity_text')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_entity_text', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_text', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_text', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_text', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_text', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_text', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Category Text Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_category_entity_varchar' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_entity_varchar')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_entity_varchar', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_varchar', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_varchar', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_category_entity_varchar', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Category Varchar Attribute Backend Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_category_product' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_product')) - ->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( - $installer->getIdxName('catalog_category_product', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_category_product', 'category_id', 'catalog_category_entity', 'entity_id'), - 'category_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_category_product', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product To Category Linkage Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_category_product_index' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_category_product_index')) - ->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, - ['unsigned' => false, 'nullable' => true, 'default' => null], - 'Position' - ) - ->addColumn( - 'is_parent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Parent' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'visibility', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Visibility' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_product_index', - ['product_id', 'store_id', 'category_id', 'visibility'] - ), - ['product_id', 'store_id', 'category_id', 'visibility'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_category_product_index', - ['store_id', 'category_id', 'visibility', 'is_parent', 'position'] - ), - ['store_id', 'category_id', 'visibility', 'is_parent', 'position'] - ) - ->setComment('Catalog Category Product Index'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_compare_item' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_compare_item') - ) - ->addColumn( - 'catalog_compare_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Compare Item ID' - ) - ->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Visitor ID' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store ID' - ) - ->addIndex( - $installer->getIdxName('catalog_compare_item', ['product_id']), - ['product_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_compare_item', ['visitor_id', 'product_id']), - ['visitor_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_compare_item', ['customer_id', 'product_id']), - ['customer_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_compare_item', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_compare_item', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_compare_item', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_compare_item', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Compare Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_website' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_website') - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addIndex( - $installer->getIdxName('catalog_product_website', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_website', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product To Website Linkage Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_link_type' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link_type') - ) - ->addColumn( - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Link Type ID' - ) - ->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true, 'default' => null], - 'Code' - ) - ->setComment( - 'Catalog Product Link Type Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_link' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link') - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Link ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'linked_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Linked Product ID' - ) - ->addColumn( - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Link Type ID' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_link', - ['link_type_id', 'product_id', 'linked_product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['link_type_id', 'product_id', 'linked_product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_link', ['product_id']), - ['product_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_link', ['linked_product_id']), - ['linked_product_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link', 'linked_product_id', 'catalog_product_entity', 'entity_id'), - 'linked_product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link', 'link_type_id', 'catalog_product_link_type', 'link_type_id'), - 'link_type_id', - $installer->getTable('catalog_product_link_type'), - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product To Product Linkage Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_link_attribute' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link_attribute') - ) - ->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Link Attribute ID' - ) - ->addColumn( - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Link Type ID' - ) - ->addColumn( - 'product_link_attribute_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true, 'default' => null], - 'Product Link Attribute Code' - ) - ->addColumn( - 'data_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true, 'default' => null], - 'Data Type' - ) - ->addIndex( - $installer->getIdxName('catalog_product_link_attribute', ['link_type_id']), - ['link_type_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute', - 'link_type_id', - 'catalog_product_link_type', - 'link_type_id' - ), - 'link_type_id', - $installer->getTable('catalog_product_link_type'), - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Link Attribute Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_link_attribute_decimal' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link_attribute_decimal') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Product Link Attribute ID' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Link ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_link_attribute_decimal', ['link_id']), - ['link_id'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_link_attribute_decimal', - ['product_link_attribute_id', 'link_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_link_attribute_id', 'link_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_decimal', 'link_id', 'catalog_product_link', 'link_id'), - 'link_id', - $installer->getTable('catalog_product_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute_decimal', - 'product_link_attribute_id', - 'catalog_product_link_attribute', - 'product_link_attribute_id' - ), - 'product_link_attribute_id', - $installer->getTable('catalog_product_link_attribute'), - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Link Decimal Attribute Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_link_attribute_int' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link_attribute_int') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Product Link Attribute ID' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Link ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_link_attribute_int', ['link_id']), - ['link_id'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_link_attribute_int', - ['product_link_attribute_id', 'link_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_link_attribute_id', 'link_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_int', 'link_id', 'catalog_product_link', 'link_id'), - 'link_id', - $installer->getTable('catalog_product_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute_int', - 'product_link_attribute_id', - 'catalog_product_link_attribute', - 'product_link_attribute_id' - ), - 'product_link_attribute_id', - $installer->getTable('catalog_product_link_attribute'), - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Link Integer Attribute Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_link_attribute_varchar' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_link_attribute_varchar') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Link Attribute ID' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Link ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_link_attribute_varchar', ['link_id']), - ['link_id'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_link_attribute_varchar', - ['product_link_attribute_id', 'link_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_link_attribute_id', 'link_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_varchar', 'link_id', 'catalog_product_link', 'link_id'), - 'link_id', - $installer->getTable('catalog_product_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute_varchar', - 'product_link_attribute_id', - 'catalog_product_link_attribute', - 'product_link_attribute_id' - ), - 'product_link_attribute_id', - $installer->getTable('catalog_product_link_attribute'), - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Link Varchar Attribute Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_entity_tier_price' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_entity_tier_price') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'all_groups', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Applicable To All Customer Groups' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Group ID' - ) - ->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '1.0000'], - 'QTY' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Website ID' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_tier_price', - ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_tier_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_tier_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_tier_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_tier_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Tier Price Attribute Backend Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_entity_media_gallery' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_entity_media_gallery') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery', ['entity_id']), - ['entity_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_media_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_media_gallery', - 'entity_id', - 'catalog_product_entity', - 'entity_id' - ), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Media Gallery Attribute Backend Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_entity_media_gallery_value' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_entity_media_gallery_value') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Value ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Label' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Position' - ) - ->addColumn( - 'disabled', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Disabled' - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery_value', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery_value', ['entity_id']), - ['entity_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_media_gallery_value', - 'value_id', - 'catalog_product_entity_media_gallery', - 'value_id' - ), - 'value_id', - $installer->getTable('catalog_product_entity_media_gallery'), - 'value_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_media_gallery_value', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_media_gallery_value', - 'entity_id', - 'catalog_product_entity', - 'entity_id' - ), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Media Gallery Attribute Value Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_option' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option') - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => true, 'default' => null], - 'Type' - ) - ->addColumn( - 'is_require', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Is Required' - ) - ->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - [], - 'SKU' - ) - ->addColumn( - 'max_characters', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Max Characters' - ) - ->addColumn( - 'file_extension', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'File Extension' - ) - ->addColumn( - 'image_size_x', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Image Size X' - ) - ->addColumn( - 'image_size_y', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Image Size Y' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - ) - ->addIndex( - $installer->getIdxName('catalog_product_option', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_option_price' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option_price') - ) - ->addColumn( - 'option_price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Price ID' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' - ) - ->addColumn( - 'price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 7, - ['nullable' => false, 'default' => 'fixed'], - 'Price Type' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_option_price', - ['option_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['option_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_option_price', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_price', 'option_id', 'catalog_product_option', 'option_id'), - 'option_id', - $installer->getTable('catalog_product_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_price', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Price Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_option_title' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option_title') - ) - ->addColumn( - 'option_title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Title ID' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Title' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_option_title', - ['option_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['option_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_option_title', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_title', 'option_id', 'catalog_product_option', 'option_id'), - 'option_id', - $installer->getTable('catalog_product_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Title Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_option_type_value' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option_type_value') - ) - ->addColumn( - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Type ID' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option ID' - ) - ->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - [], - 'SKU' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - ) - ->addIndex( - $installer->getIdxName('catalog_product_option_type_value', ['option_id']), - ['option_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_type_value', 'option_id', 'catalog_product_option', 'option_id'), - 'option_id', - $installer->getTable('catalog_product_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Type Value Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_option_type_price' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option_type_price') - ) - ->addColumn( - 'option_type_price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Type Price ID' - ) - ->addColumn( - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option Type ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' - ) - ->addColumn( - 'price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 7, - ['nullable' => false, 'default' => 'fixed'], - 'Price Type' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_option_type_price', - ['option_type_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['option_type_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_option_type_price', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_option_type_price', - 'option_type_id', - 'catalog_product_option_type_value', - 'option_type_id' - ), - 'option_type_id', - $installer->getTable('catalog_product_option_type_value'), - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_type_price', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Type Price Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_option_type_title' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_option_type_title') - ) - ->addColumn( - 'option_type_title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Type Title ID' - ) - ->addColumn( - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option Type ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Title' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_option_type_title', - ['option_type_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['option_type_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_option_type_title', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_option_type_title', - 'option_type_id', - 'catalog_product_option_type_value', - 'option_type_id' - ), - 'option_type_id', - $installer->getTable('catalog_product_option_type_value'), - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_option_type_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Option Type Title Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_eav_attribute' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_eav_attribute') - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'frontend_input_renderer', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Frontend Input Renderer' - ) - ->addColumn( - 'is_global', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Global' - ) - ->addColumn( - 'is_visible', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Visible' - ) - ->addColumn( - 'is_searchable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Searchable' - ) - ->addColumn( - 'is_filterable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Filterable' - ) - ->addColumn( - 'is_comparable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Comparable' - ) - ->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible On Front' - ) - ->addColumn( - 'is_html_allowed_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is HTML Allowed On Front' - ) - ->addColumn( - 'is_used_for_price_rules', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Used For Price Rules' - ) - ->addColumn( - 'is_filterable_in_search', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Filterable In Search' - ) - ->addColumn( - 'used_in_product_listing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Used In Product Listing' - ) - ->addColumn( - 'used_for_sort_by', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Used For Sorting' - ) - ->addColumn( - 'apply_to', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Apply To' - ) - ->addColumn( - 'is_visible_in_advanced_search', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible In Advanced Search' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Position' - ) - ->addColumn( - 'is_wysiwyg_enabled', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is WYSIWYG Enabled' - ) - ->addColumn( - 'is_used_for_promo_rules', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Used For Promo Rules' - ) - ->addColumn( - 'is_required_in_admin_store', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Required In Admin Store' - ) - ->addIndex( - $installer->getIdxName('catalog_eav_attribute', ['used_for_sort_by']), - ['used_for_sort_by'] - ) - ->addIndex( - $installer->getIdxName('catalog_eav_attribute', ['used_in_product_listing']), - ['used_in_product_listing'] - ) - ->addForeignKey( - $installer->getFkName('catalog_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog EAV Attribute Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_relation' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_relation') - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Parent ID' - ) - ->addColumn( - 'child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Child ID' - ) - ->addIndex( - $installer->getIdxName('catalog_product_relation', ['child_id']), - ['child_id'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_relation', 'child_id', 'catalog_product_entity', 'entity_id'), - 'child_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_relation', 'parent_id', 'catalog_product_entity', 'entity_id'), - 'parent_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Relation Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_eav' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav', ['value']), - ['value'] - ) - ->setComment( - 'Catalog Product EAV Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_eav_decimal' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav_decimal') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'primary' => false], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal', ['value']), - ['value'] - ) - ->setComment( - 'Catalog Product EAV Decimal Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'final_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Final Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price', ['min_price']), - ['min_price'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price', ['website_id', 'customer_group_id', 'min_price']), - ['website_id', 'customer_group_id', 'min_price'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_index_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Price Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_tier_price' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_tier_price') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_tier_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_tier_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_index_tier_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_tier_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Tier Price Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_website' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_website') - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'website_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Website Date' - ) - ->addColumn( - 'rate', - \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, - null, - ['default' => '1.0000'], - 'Rate' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_website', ['website_date']), - ['website_date'] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Website Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_cfg_opt_agr_idx' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_agr_idx') - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Parent ID' - ) - ->addColumn( - 'child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Child ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setComment( - 'Catalog Product Price Indexer Config Option Aggregate Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_cfg_opt_agr_tmp' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_agr_tmp') - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Parent ID' - ) - ->addColumn( - 'child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Child ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Config Option Aggregate Temp Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_cfg_opt_idx' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setComment( - 'Catalog Product Price Indexer Config Option Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_cfg_opt_tmp' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Config Option Temp Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_final_idx' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_final_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class ID' - ) - ->addColumn( - 'orig_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Original Price' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'base_tier', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tier' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) - ->setComment( - 'Catalog Product Price Indexer Final Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_final_tmp' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_final_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class ID' - ) - ->addColumn( - 'orig_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Original Price' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'base_tier', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tier' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addColumn( - 'base_group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Group Price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Final Temp Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_opt_idx' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_opt_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setComment( - 'Catalog Product Price Indexer Option Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_opt_tmp' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_opt_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Option Temp Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_opt_agr_idx' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_opt_agr_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setComment( - 'Catalog Product Price Indexer Option Aggregate Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_opt_agr_tmp' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_opt_agr_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Option ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Option Aggregate Temp Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_eav_idx' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_idx', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_idx', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_idx', ['value']), - ['value'] - ) - ->setComment( - 'Catalog Product EAV Indexer Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_eav_tmp' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_tmp', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_tmp', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_tmp', ['value']), - ['value'] - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product EAV Indexer Temp Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_eav_decimal_idx' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav_decimal_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'primary' => true], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['value']), - ['value'] - ) - ->setComment( - 'Catalog Product EAV Decimal Indexer Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_eav_decimal_tmp' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_eav_decimal_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'primary' => false], - 'Value' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['attribute_id']), - ['attribute_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['value']), - ['value'] - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product EAV Decimal Indexer Temp Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_idx' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_idx') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'final_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Final Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_idx', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_idx', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_idx', ['min_price']), - ['min_price'] - ) - ->setComment( - 'Catalog Product Price Indexer Index Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_price_tmp' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_price_tmp') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Tax Class ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - ) - ->addColumn( - 'final_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Final Price' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Max Price' - ) - ->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tier Price' - ) - ->addColumn( - 'group_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Group price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_tmp', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_tmp', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_price_tmp', ['min_price']), - ['min_price'] - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Product Price Indexer Temp Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_category_product_index_tmp' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_category_product_index_tmp') - ) - ->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Category ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Position' - ) - ->addColumn( - 'is_parent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Parent' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'visibility', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Visibility' - ) - ->addIndex( - $installer->getIdxName('catalog_category_product_index_tmp', ['product_id', 'category_id', 'store_id']), - ['product_id', 'category_id', 'store_id'] - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment( - 'Catalog Category Product Indexer Temp Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_entity_group_price' - */ - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_entity_group_price') - ) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity ID' - ) - ->addColumn( - 'all_groups', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Applicable To All Customer Groups' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Group ID' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Value' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Website ID' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_entity_group_price', - ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_group_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_entity_group_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_group_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_group_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity_group_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Group Price Attribute Backend Table' - ); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'catalog_product_index_group_price' - */ - - $table = $installer->getConnection() - ->newTable( - $installer->getTable('catalog_product_index_group_price') - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Min Price' - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_group_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalog_product_index_group_price', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_index_group_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_group_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_index_group_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment( - 'Catalog Product Group Price Index Table' - ); - $installer->getConnection() - ->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'catalog_product_entity' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'default' => 'simple'], + 'Type ID' + ) + ->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + [], + 'SKU' + ) + ->addColumn( + 'has_options', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Has Options' + ) + ->addColumn( + 'required_options', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Required Options' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Creation Time' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + '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'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity', ['sku']), + ['sku'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity', + 'attribute_set_id', + 'eav_attribute_set', + 'attribute_set_id' + ), + 'attribute_set_id', + $installer->getTable('eav_attribute_set'), + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_datetime' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_datetime')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_datetime', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_datetime', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_datetime', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', + 'attribute_id', + 'eav_attribute', + 'attribute_id' + ), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Datetime Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_decimal' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_decimal')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_decimal', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_decimal', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_decimal', ['attribute_id']), + ['attribute_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', + 'attribute_id', + 'eav_attribute', + 'attribute_id' + ), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Decimal Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_int' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_int')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_int', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_int', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_int', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Integer Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_text' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_text')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_text', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_text', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_text', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_text', + 'attribute_id', + 'eav_attribute', + 'attribute_id' + ), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_text', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_text', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Text Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_varchar' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_varchar')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_varchar', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_varchar', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_varchar', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', + 'attribute_id', + 'eav_attribute', + 'attribute_id' + ), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Varchar Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_entity_gallery' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_gallery')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_gallery', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', + 'attribute_id', + 'eav_attribute', + 'attribute_id' + ), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Gallery Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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'], + 'Attriute Set ID' + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Parent Category ID' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Creation Time' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Update Time' + ) + ->addColumn( + 'path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Tree Path' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Position' + ) + ->addColumn( + 'level', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Tree Level' + ) + ->addColumn( + 'children_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Child Count' + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity', ['level']), + ['level'] + ) + ->setComment('Catalog Category Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity_datetime' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_datetime')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_datetime', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', + 'attribute_id', + 'eav_attribute', + 'attribute_id' + ), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', + 'entity_id', + 'catalog_category_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Datetime Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity_decimal' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_decimal')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_decimal', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', + 'attribute_id', + 'eav_attribute', + 'attribute_id' + ), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', + 'entity_id', + 'catalog_category_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Decimal Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity_int' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_int')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_int', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_int', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_int', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_int', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_int', + 'entity_id', + 'catalog_category_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Integer Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity_text' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_text')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_text', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_text', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_text', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_text', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_text', + 'entity_id', + 'catalog_category_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Text Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_entity_varchar' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_varchar')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_varchar', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', + 'attribute_id', + 'eav_attribute', + 'attribute_id' + ), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', + 'entity_id', + 'catalog_category_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Varchar Attribute Backend Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_product' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_product')) + ->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( + $installer->getIdxName('catalog_category_product', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_product', + 'category_id', + 'catalog_category_entity', + 'entity_id' + ), + 'category_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_product', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product To Category Linkage Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_category_product_index' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_product_index')) + ->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, + ['unsigned' => false, 'nullable' => true, 'default' => null], + 'Position' + ) + ->addColumn( + 'is_parent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Parent' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'visibility', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Visibility' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_product_index', + ['product_id', 'store_id', 'category_id', 'visibility'] + ), + ['product_id', 'store_id', 'category_id', 'visibility'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_product_index', + ['store_id', 'category_id', 'visibility', 'is_parent', 'position'] + ), + ['store_id', 'category_id', 'visibility', 'is_parent', 'position'] + ) + ->setComment('Catalog Category Product Index'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_compare_item' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_compare_item') + ) + ->addColumn( + 'catalog_compare_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Compare Item ID' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Visitor ID' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store ID' + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['product_id']), + ['product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['visitor_id', 'product_id']), + ['visitor_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['customer_id', 'product_id']), + ['customer_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_compare_item', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_compare_item', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_compare_item', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Compare Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_website' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_website') + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName('catalog_product_website', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_website', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product To Website Linkage Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link_type' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_type') + ) + ->addColumn( + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link Type ID' + ) + ->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Code' + ) + ->setComment( + 'Catalog Product Link Type Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link') + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'linked_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Linked Product ID' + ) + ->addColumn( + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link Type ID' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link', + ['link_type_id', 'product_id', 'linked_product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['link_type_id', 'product_id', 'linked_product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_link', ['product_id']), + ['product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_link', ['linked_product_id']), + ['linked_product_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link', + 'linked_product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'linked_product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link', + 'link_type_id', + 'catalog_product_link_type', + 'link_type_id' + ), + 'link_type_id', + $installer->getTable('catalog_product_link_type'), + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product To Product Linkage Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link_attribute' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute') + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link Type ID' + ) + ->addColumn( + 'product_link_attribute_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Product Link Attribute Code' + ) + ->addColumn( + 'data_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Data Type' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute', ['link_type_id']), + ['link_type_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute', + 'link_type_id', + 'catalog_product_link_type', + 'link_type_id' + ), + 'link_type_id', + $installer->getTable('catalog_product_link_type'), + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Attribute Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link_attribute_decimal' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute_decimal') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Link ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute_decimal', ['link_id']), + ['link_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_decimal', + ['product_link_attribute_id', 'link_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_link_attribute_id', 'link_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_decimal', + 'link_id', + 'catalog_product_link', + 'link_id' + ), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_decimal', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Decimal Attribute Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link_attribute_int' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute_int') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Link ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute_int', ['link_id']), + ['link_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_int', + ['product_link_attribute_id', 'link_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_link_attribute_id', 'link_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_int', + 'link_id', + 'catalog_product_link', + 'link_id' + ), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_int', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Integer Attribute Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_link_attribute_varchar' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute_varchar') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Link ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute_varchar', ['link_id']), + ['link_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_varchar', + ['product_link_attribute_id', 'link_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_link_attribute_id', 'link_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_varchar', + 'link_id', + 'catalog_product_link', + 'link_id' + ), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_varchar', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Varchar Attribute Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_entity_tier_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_tier_price') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'all_groups', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Applicable To All Customer Groups' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Group ID' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '1.0000'], + 'QTY' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_tier_price', + ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_tier_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_tier_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_tier_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_tier_price', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_tier_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Tier Price Attribute Backend Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_entity_media_gallery' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_media_gallery') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery', ['entity_id']), + ['entity_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_media_gallery', + 'attribute_id', + 'eav_attribute', + 'attribute_id' + ), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_media_gallery', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Media Gallery Attribute Backend Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_entity_media_gallery_value' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_media_gallery_value') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Value ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Label' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Position' + ) + ->addColumn( + 'disabled', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Disabled' + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery_value', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery_value', ['entity_id']), + ['entity_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_media_gallery_value', + 'value_id', + 'catalog_product_entity_media_gallery', + 'value_id' + ), + 'value_id', + $installer->getTable('catalog_product_entity_media_gallery'), + 'value_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_media_gallery_value', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_media_gallery_value', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Media Gallery Attribute Value Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option') + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => true, 'default' => null], + 'Type' + ) + ->addColumn( + 'is_require', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Is Required' + ) + ->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + [], + 'SKU' + ) + ->addColumn( + 'max_characters', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Max Characters' + ) + ->addColumn( + 'file_extension', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'File Extension' + ) + ->addColumn( + 'image_size_x', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Image Size X' + ) + ->addColumn( + 'image_size_y', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Image Size Y' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addIndex( + $installer->getIdxName('catalog_product_option', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_price') + ) + ->addColumn( + 'option_price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Price ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + ) + ->addColumn( + 'price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 7, + ['nullable' => false, 'default' => 'fixed'], + 'Price Type' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_price', + ['option_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_price', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_price', + 'option_id', + 'catalog_product_option', + 'option_id' + ), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_price', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Price Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option_title' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_title') + ) + ->addColumn( + 'option_title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Title ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_title', + ['option_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_title', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_title', + 'option_id', + 'catalog_product_option', + 'option_id' + ), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Title Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option_type_value' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_type_value') + ) + ->addColumn( + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Type ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + [], + 'SKU' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_type_value', ['option_id']), + ['option_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_type_value', + 'option_id', + 'catalog_product_option', + 'option_id' + ), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Type Value Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option_type_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_type_price') + ) + ->addColumn( + 'option_type_price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Type Price ID' + ) + ->addColumn( + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option Type ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + ) + ->addColumn( + 'price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 7, + ['nullable' => false, 'default' => 'fixed'], + 'Price Type' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_type_price', + ['option_type_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_type_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_type_price', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_option_type_price', + 'option_type_id', + 'catalog_product_option_type_value', + 'option_type_id' + ), + 'option_type_id', + $installer->getTable('catalog_product_option_type_value'), + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_type_price', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Type Price Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_option_type_title' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_type_title') + ) + ->addColumn( + 'option_type_title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Type Title ID' + ) + ->addColumn( + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option Type ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_type_title', + ['option_type_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_type_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_type_title', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_option_type_title', + 'option_type_id', + 'catalog_product_option_type_value', + 'option_type_id' + ), + 'option_type_id', + $installer->getTable('catalog_product_option_type_value'), + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_type_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Type Title Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_eav_attribute' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_eav_attribute') + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'frontend_input_renderer', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Frontend Input Renderer' + ) + ->addColumn( + 'is_global', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Global' + ) + ->addColumn( + 'is_visible', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Visible' + ) + ->addColumn( + 'is_searchable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Searchable' + ) + ->addColumn( + 'is_filterable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Filterable' + ) + ->addColumn( + 'is_comparable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Comparable' + ) + ->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + ) + ->addColumn( + 'is_html_allowed_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is HTML Allowed On Front' + ) + ->addColumn( + 'is_used_for_price_rules', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used For Price Rules' + ) + ->addColumn( + 'is_filterable_in_search', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Filterable In Search' + ) + ->addColumn( + 'used_in_product_listing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used In Product Listing' + ) + ->addColumn( + 'used_for_sort_by', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used For Sorting' + ) + ->addColumn( + 'apply_to', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Apply To' + ) + ->addColumn( + 'is_visible_in_advanced_search', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible In Advanced Search' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'is_wysiwyg_enabled', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is WYSIWYG Enabled' + ) + ->addColumn( + 'is_used_for_promo_rules', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used For Promo Rules' + ) + ->addColumn( + 'is_required_in_admin_store', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Required In Admin Store' + ) + ->addIndex( + $installer->getIdxName('catalog_eav_attribute', ['used_for_sort_by']), + ['used_for_sort_by'] + ) + ->addIndex( + $installer->getIdxName('catalog_eav_attribute', ['used_in_product_listing']), + ['used_in_product_listing'] + ) + ->addForeignKey( + $installer->getFkName('catalog_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog EAV Attribute Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_relation' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_relation') + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Parent ID' + ) + ->addColumn( + 'child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Child ID' + ) + ->addIndex( + $installer->getIdxName('catalog_product_relation', ['child_id']), + ['child_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_relation', 'child_id', 'catalog_product_entity', 'entity_id'), + 'child_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_relation', 'parent_id', 'catalog_product_entity', 'entity_id'), + 'parent_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Relation Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav_decimal' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_decimal') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'primary' => false], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Decimal Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'final_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Final Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price', ['min_price']), + ['min_price'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price', ['website_id', 'customer_group_id', 'min_price']), + ['website_id', 'customer_group_id', 'min_price'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_index_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Price Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_tier_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_tier_price') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_tier_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_tier_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_index_tier_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_tier_price', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_tier_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Tier Price Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_website' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_website') + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'website_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Website Date' + ) + ->addColumn( + 'rate', + \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, + null, + ['default' => '1.0000'], + 'Rate' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_website', ['website_date']), + ['website_date'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Website Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_cfg_opt_agr_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_agr_idx') + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Parent ID' + ) + ->addColumn( + 'child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Child ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Aggregate Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_cfg_opt_agr_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_agr_tmp') + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Parent ID' + ) + ->addColumn( + 'child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Child ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Aggregate Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_cfg_opt_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_cfg_opt_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_final_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_final_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'orig_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Original Price' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'base_tier', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tier' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'base_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Group Price' + ) + ->setComment( + 'Catalog Product Price Indexer Final Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_final_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_final_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'orig_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Original Price' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'base_tier', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tier' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'base_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Group Price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Final Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_opt_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Option Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_opt_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Option Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_opt_agr_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_agr_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Option Aggregate Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_opt_agr_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_agr_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Option Aggregate Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Indexer Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', ['value']), + ['value'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product EAV Indexer Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav_decimal_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_decimal_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Decimal Indexer Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_eav_decimal_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_decimal_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'primary' => false], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['value']), + ['value'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product EAV Decimal Indexer Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_idx' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'final_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Final Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', ['min_price']), + ['min_price'] + ) + ->setComment( + 'Catalog Product Price Indexer Index Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_price_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'final_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Final Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', ['min_price']), + ['min_price'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_category_product_index_tmp' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_category_product_index_tmp') + ) + ->addColumn( + 'category_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Category ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'is_parent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Parent' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'visibility', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Visibility' + ) + ->addIndex( + $installer->getIdxName('catalog_category_product_index_tmp', ['product_id', 'category_id', 'store_id']), + ['product_id', 'category_id', 'store_id'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Category Product Indexer Temp Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_entity_group_price' + */ + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_group_price') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'all_groups', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Applicable To All Customer Groups' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Group ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_group_price', + ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_group_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_group_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_group_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_group_price', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_group_price', + 'website_id', + 'store_website', + 'website_id' + ), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Group Price Attribute Backend Table' + ); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'catalog_product_index_group_price' + */ + + $table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_group_price') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_group_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_group_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_index_group_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_group_price', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_group_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Group Price Index Table' + ); + $installer->getConnection() + ->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index 465286331e00b..87b2c4965314f 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -1,11 +1,8 @@ getVersion(), '2.0.0.1') <= 0) { $installer = $setup; @@ -49,5 +46,5 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } - } + } } \ No newline at end of file diff --git a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php index b761d578ab3d8..406e6597638b9 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'cataloginventory_stock' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('cataloginventory_stock')) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Stock Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 5, - ['unsigned' => true, 'nullable' => false], - 'Website Id' - ) - ->addColumn( - 'stock_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Stock Name' - ) - ->addIndex( - $setup->getIdxName( - $installer->getTable('cataloginventory_stock'), - ['website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX - ), - ['website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX - ) - ->setComment('Cataloginventory Stock'); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'cataloginventory_stock_item' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('cataloginventory_stock_item')) - ->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Item Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Id' - ) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Stock Id' - ) - ->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['unsigned' => false, 'nullable' => true, 'default' => null], - 'Qty' - ) - ->addColumn( - 'min_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Min Qty' - ) - ->addColumn( - 'use_config_min_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Min Qty' - ) - ->addColumn( - 'is_qty_decimal', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Qty Decimal' - ) - ->addColumn( - 'backorders', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Backorders' - ) - ->addColumn( - 'use_config_backorders', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Backorders' - ) - ->addColumn( - 'min_sale_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '1.0000'], - 'Min Sale Qty' - ) - ->addColumn( - 'use_config_min_sale_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Min Sale Qty' - ) - ->addColumn( - 'max_sale_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Max Sale Qty' - ) - ->addColumn( - 'use_config_max_sale_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Max Sale Qty' - ) - ->addColumn( - 'is_in_stock', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is In Stock' - ) - ->addColumn( - 'low_stock_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Low Stock Date' - ) - ->addColumn( - 'notify_stock_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Notify Stock Qty' - ) - ->addColumn( - 'use_config_notify_stock_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Notify Stock Qty' - ) - ->addColumn( - 'manage_stock', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Manage Stock' - ) - ->addColumn( - 'use_config_manage_stock', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Manage Stock' - ) - ->addColumn( - 'stock_status_changed_auto', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Stock Status Changed Automatically' - ) - ->addColumn( - 'use_config_qty_increments', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Qty Increments' - ) - ->addColumn( - 'qty_increments', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty Increments' - ) - ->addColumn( - 'use_config_enable_qty_inc', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Use Config Enable Qty Increments' - ) - ->addColumn( - 'enable_qty_increments', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Enable Qty Increments' - ) - ->addColumn( - 'is_decimal_divided', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 5, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Divided into Multiple Boxes for Shipping' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 5, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Is Divided into Multiple Boxes for Shipping' - ) - ->addIndex( - $installer->getIdxName( - 'cataloginventory_stock_item', - ['product_id', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_id', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName( - 'cataloginventory_stock_item', - ['website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX - ), - ['website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX] - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_item', ['stock_id']), - ['stock_id'] - ) - ->addForeignKey( - $installer->getFkName('cataloginventory_stock_item', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('cataloginventory_stock_item', 'stock_id', 'cataloginventory_stock', 'stock_id'), - 'stock_id', - $installer->getTable('cataloginventory_stock'), - 'stock_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Cataloginventory Stock Item'); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'cataloginventory_stock_status' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('cataloginventory_stock_status')) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Stock Id' - ) - ->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty' - ) - ->addColumn( - 'stock_status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Stock Status' - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status', ['stock_id']), - ['stock_id'] - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status', ['website_id']), - ['website_id'] - ) - ->setComment('Cataloginventory Stock Status'); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'cataloginventory_stock_status_idx' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('cataloginventory_stock_status_idx')) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Stock Id' - ) - ->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty' - ) - ->addColumn( - 'stock_status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Stock Status' - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status_idx', ['stock_id']), - ['stock_id'] - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status_idx', ['website_id']), - ['website_id'] - ) - ->setComment('Cataloginventory Stock Status Indexer Idx'); - $installer->getConnection() - ->createTable($table); - - /** - * Create table 'cataloginventory_stock_status_tmp' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('cataloginventory_stock_status_tmp')) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addColumn( - 'stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Stock Id' - ) - ->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty' - ) - ->addColumn( - 'stock_status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Stock Status' - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status_tmp', ['stock_id']), - ['stock_id'] - ) - ->addIndex( - $installer->getIdxName('cataloginventory_stock_status_tmp', ['website_id']), - ['website_id'] - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment('Cataloginventory Stock Status Indexer Tmp'); - $installer->getConnection() - ->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'cataloginventory_stock' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('cataloginventory_stock')) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Stock Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 5, + ['unsigned' => true, 'nullable' => false], + 'Website Id' + ) + ->addColumn( + 'stock_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Stock Name' + ) + ->addIndex( + $setup->getIdxName( + $installer->getTable('cataloginventory_stock'), + ['website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX + ), + ['website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX + ) + ->setComment('Cataloginventory Stock'); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'cataloginventory_stock_item' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('cataloginventory_stock_item')) + ->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Item Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Id' + ) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Stock Id' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['unsigned' => false, 'nullable' => true, 'default' => null], + 'Qty' + ) + ->addColumn( + 'min_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Min Qty' + ) + ->addColumn( + 'use_config_min_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Min Qty' + ) + ->addColumn( + 'is_qty_decimal', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Qty Decimal' + ) + ->addColumn( + 'backorders', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Backorders' + ) + ->addColumn( + 'use_config_backorders', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Backorders' + ) + ->addColumn( + 'min_sale_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '1.0000'], + 'Min Sale Qty' + ) + ->addColumn( + 'use_config_min_sale_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Min Sale Qty' + ) + ->addColumn( + 'max_sale_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Max Sale Qty' + ) + ->addColumn( + 'use_config_max_sale_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Max Sale Qty' + ) + ->addColumn( + 'is_in_stock', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is In Stock' + ) + ->addColumn( + 'low_stock_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Low Stock Date' + ) + ->addColumn( + 'notify_stock_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Notify Stock Qty' + ) + ->addColumn( + 'use_config_notify_stock_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Notify Stock Qty' + ) + ->addColumn( + 'manage_stock', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Manage Stock' + ) + ->addColumn( + 'use_config_manage_stock', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Manage Stock' + ) + ->addColumn( + 'stock_status_changed_auto', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Stock Status Changed Automatically' + ) + ->addColumn( + 'use_config_qty_increments', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Qty Increments' + ) + ->addColumn( + 'qty_increments', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty Increments' + ) + ->addColumn( + 'use_config_enable_qty_inc', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Use Config Enable Qty Increments' + ) + ->addColumn( + 'enable_qty_increments', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Enable Qty Increments' + ) + ->addColumn( + 'is_decimal_divided', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 5, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Divided into Multiple Boxes for Shipping' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 5, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Is Divided into Multiple Boxes for Shipping' + ) + ->addIndex( + $installer->getIdxName( + 'cataloginventory_stock_item', + ['product_id', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_id', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName( + 'cataloginventory_stock_item', + ['website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX + ), + ['website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX] + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_item', ['stock_id']), + ['stock_id'] + ) + ->addForeignKey( + $installer->getFkName('cataloginventory_stock_item', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('cataloginventory_stock_item', 'stock_id', 'cataloginventory_stock', 'stock_id'), + 'stock_id', + $installer->getTable('cataloginventory_stock'), + 'stock_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Cataloginventory Stock Item'); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'cataloginventory_stock_status' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('cataloginventory_stock_status')) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Stock Id' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty' + ) + ->addColumn( + 'stock_status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Stock Status' + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status', ['stock_id']), + ['stock_id'] + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status', ['website_id']), + ['website_id'] + ) + ->setComment('Cataloginventory Stock Status'); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'cataloginventory_stock_status_idx' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('cataloginventory_stock_status_idx')) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Stock Id' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty' + ) + ->addColumn( + 'stock_status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Stock Status' + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status_idx', ['stock_id']), + ['stock_id'] + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status_idx', ['website_id']), + ['website_id'] + ) + ->setComment('Cataloginventory Stock Status Indexer Idx'); + $installer->getConnection() + ->createTable($table); + + /** + * Create table 'cataloginventory_stock_status_tmp' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('cataloginventory_stock_status_tmp')) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addColumn( + 'stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Stock Id' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty' + ) + ->addColumn( + 'stock_status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Stock Status' + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status_tmp', ['stock_id']), + ['stock_id'] + ) + ->addIndex( + $installer->getIdxName('cataloginventory_stock_status_tmp', ['website_id']), + ['website_id'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment('Cataloginventory Stock Status Indexer Tmp'); + $installer->getConnection() + ->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/CatalogRule/Setup/InstallSchema.php b/app/code/Magento/CatalogRule/Setup/InstallSchema.php index f9443b1f1bddd..26ef4f07b7ede 100644 --- a/app/code/Magento/CatalogRule/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogRule/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'catalogrule' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule')) - ->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' - ) - ->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' - ) - ->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - ) - ->addColumn( - 'from_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'From Date' - ) - ->addColumn( - 'to_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'To Date' - ) - ->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Is Active' - ) - ->addColumn( - 'conditions_serialized', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Conditions Serialized' - ) - ->addColumn( - 'actions_serialized', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Actions Serialized' - ) - ->addColumn( - 'stop_rules_processing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Stop Rules Processing' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - ) - ->addColumn( - 'simple_action', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Simple Action' - ) - ->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => 0.0000], - 'Discount Amount' - ) - ->addColumn( - 'sub_is_enable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Rule Enable For Subitems' - ) - ->addColumn( - 'sub_simple_action', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Simple Action For Subitems' - ) - ->addColumn( - 'sub_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => 0.0000], - 'Discount Amount For Subitems' - ) - ->addIndex( - $installer->getIdxName('catalogrule', ['is_active', 'sort_order', 'to_date', 'from_date']), - ['is_active', 'sort_order', 'to_date', 'from_date'] - ) - ->setComment('CatalogRule'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalogrule_product' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_product')) - ->addColumn( - 'rule_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Product Id' - ) - ->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rule Id' - ) - ->addColumn( - 'from_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'From Time' - ) - ->addColumn( - 'to_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'To time' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Group Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Id' - ) - ->addColumn( - 'action_operator', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 10, - ['default' => 'to_fixed'], - 'Action Operator' - ) - ->addColumn( - 'action_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Action Amount' - ) - ->addColumn( - 'action_stop', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Action Stop' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Website Id' - ) - ->addColumn( - 'sub_simple_action', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Simple Action For Subitems' - ) - ->addColumn( - 'sub_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount For Subitems' - ) - ->addIndex( - $installer->getIdxName( - 'catalogrule_product', - ['rule_id', 'from_time', 'to_time', 'website_id', 'customer_group_id', 'product_id', 'sort_order'], - true - ), - ['rule_id', 'from_time', 'to_time', 'website_id', 'customer_group_id', 'product_id', 'sort_order'], - ['type' => 'unique'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product', ['from_time']), - ['from_time'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product', ['to_time']), - ['to_time'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product', ['product_id']), - ['product_id'] - ) - ->setComment('CatalogRule Product'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalogrule_product_price' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_product_price')) - ->addColumn( - 'rule_product_price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Product PriceId' - ) - ->addColumn( - 'rule_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => false], - 'Rule Date' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Group Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Id' - ) - ->addColumn( - 'rule_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Rule Price' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Website Id' - ) - ->addColumn( - 'latest_start_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Latest StartDate' - ) - ->addColumn( - 'earliest_end_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Earliest EndDate' - ) - ->addIndex( - $installer->getIdxName( - 'catalogrule_product_price', - ['rule_date', 'website_id', 'customer_group_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['rule_date', 'website_id', 'customer_group_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product_price', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product_price', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_product_price', ['product_id']), - ['product_id'] - ) - ->setComment('CatalogRule Product Price'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalogrule_affected_product' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_affected_product')) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Id' - ) - ->setComment('CatalogRule Affected Product'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalogrule_group_website' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_group_website')) - ->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Rule Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Customer Group Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Website Id' - ) - ->addIndex( - $installer->getIdxName('catalogrule_group_website', ['customer_group_id']), - ['customer_group_id'] - ) - ->addIndex( - $installer->getIdxName('catalogrule_group_website', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName('catalogrule_group_website', 'customer_group_id', 'customer_group', 'customer_group_id'), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalogrule_group_website', 'rule_id', 'catalogrule', 'rule_id'), - 'rule_id', - $installer->getTable('catalogrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalogrule_group_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('CatalogRule Group Website'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalogrule_website' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_website')) - ->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - ) - ->addIndex( - $installer->getIdxName('catalogrule_website', ['website_id']), - ['website_id'] - ) - ->addForeignKey( - $installer->getFkName('catalogrule_website', 'rule_id', 'catalogrule', 'rule_id'), - 'rule_id', - $installer->getTable('catalogrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalogrule_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Rules To Websites Relations'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalogrule_customer_group' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalogrule_customer_group')) - ->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - ) - ->addIndex( - $installer->getIdxName('catalogrule_customer_group', ['customer_group_id']), - ['customer_group_id'] - ) - ->addForeignKey( - $installer->getFkName('catalogrule_customer_group', 'rule_id', 'catalogrule', 'rule_id'), - 'rule_id', - $installer->getTable('catalogrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalogrule_customer_group', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Rules To Customer Groups Relations'); - - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'catalogrule' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule')) + ->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + ) + ->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + ) + ->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + ) + ->addColumn( + 'from_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'From Date' + ) + ->addColumn( + 'to_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'To Date' + ) + ->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Is Active' + ) + ->addColumn( + 'conditions_serialized', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Conditions Serialized' + ) + ->addColumn( + 'actions_serialized', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Actions Serialized' + ) + ->addColumn( + 'stop_rules_processing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Stop Rules Processing' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addColumn( + 'simple_action', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Simple Action' + ) + ->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => 0.0000], + 'Discount Amount' + ) + ->addColumn( + 'sub_is_enable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Rule Enable For Subitems' + ) + ->addColumn( + 'sub_simple_action', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Simple Action For Subitems' + ) + ->addColumn( + 'sub_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => 0.0000], + 'Discount Amount For Subitems' + ) + ->addIndex( + $installer->getIdxName('catalogrule', ['is_active', 'sort_order', 'to_date', 'from_date']), + ['is_active', 'sort_order', 'to_date', 'from_date'] + ) + ->setComment('CatalogRule'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_product' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_product')) + ->addColumn( + 'rule_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Product Id' + ) + ->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rule Id' + ) + ->addColumn( + 'from_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'From Time' + ) + ->addColumn( + 'to_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'To time' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Group Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Id' + ) + ->addColumn( + 'action_operator', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 10, + ['default' => 'to_fixed'], + 'Action Operator' + ) + ->addColumn( + 'action_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Action Amount' + ) + ->addColumn( + 'action_stop', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Action Stop' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Website Id' + ) + ->addColumn( + 'sub_simple_action', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Simple Action For Subitems' + ) + ->addColumn( + 'sub_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount For Subitems' + ) + ->addIndex( + $installer->getIdxName( + 'catalogrule_product', + ['rule_id', 'from_time', 'to_time', 'website_id', 'customer_group_id', 'product_id', 'sort_order'], + true + ), + ['rule_id', 'from_time', 'to_time', 'website_id', 'customer_group_id', 'product_id', 'sort_order'], + ['type' => 'unique'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product', ['from_time']), + ['from_time'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product', ['to_time']), + ['to_time'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product', ['product_id']), + ['product_id'] + ) + ->setComment('CatalogRule Product'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_product_price' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_product_price')) + ->addColumn( + 'rule_product_price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Product PriceId' + ) + ->addColumn( + 'rule_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => false], + 'Rule Date' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Group Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Id' + ) + ->addColumn( + 'rule_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Rule Price' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Website Id' + ) + ->addColumn( + 'latest_start_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Latest StartDate' + ) + ->addColumn( + 'earliest_end_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Earliest EndDate' + ) + ->addIndex( + $installer->getIdxName( + 'catalogrule_product_price', + ['rule_date', 'website_id', 'customer_group_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['rule_date', 'website_id', 'customer_group_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product_price', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_product_price', ['product_id']), + ['product_id'] + ) + ->setComment('CatalogRule Product Price'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_affected_product' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_affected_product')) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Id' + ) + ->setComment('CatalogRule Affected Product'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_group_website' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_group_website')) + ->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Rule Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Customer Group Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Website Id' + ) + ->addIndex( + $installer->getIdxName('catalogrule_group_website', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalogrule_group_website', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName('catalogrule_group_website', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalogrule_group_website', 'rule_id', 'catalogrule', 'rule_id'), + 'rule_id', + $installer->getTable('catalogrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalogrule_group_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('CatalogRule Group Website'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_website' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_website')) + ->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + ) + ->addIndex( + $installer->getIdxName('catalogrule_website', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName('catalogrule_website', 'rule_id', 'catalogrule', 'rule_id'), + 'rule_id', + $installer->getTable('catalogrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalogrule_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Rules To Websites Relations'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalogrule_customer_group' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalogrule_customer_group')) + ->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + ) + ->addIndex( + $installer->getIdxName('catalogrule_customer_group', ['customer_group_id']), + ['customer_group_id'] + ) + ->addForeignKey( + $installer->getFkName('catalogrule_customer_group', 'rule_id', 'catalogrule', 'rule_id'), + 'rule_id', + $installer->getTable('catalogrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalogrule_customer_group', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Rules To Customer Groups Relations'); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php index bee80d5e6e54b..04281b9a0e572 100644 --- a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php @@ -1,11 +1,8 @@ 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->endSetup(); - - } + /** + * {@inheritdoc} + */ + 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->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php index a4e76f521c4f2..2c5d520867b1b 100644 --- a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - $tableName = \Magento\CatalogUrlRewrite\Model\Resource\Category\Product::TABLE_NAME; - $table = $installer->getConnection() - ->newTable($installer->getTable($tableName)) - ->addColumn( - 'url_rewrite_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'url_rewrite_id' - ) - ->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'category_id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'product_id' - ) - ->addIndex( - $installer->getIdxName($tableName, ['category_id', 'product_id']), - ['category_id', 'product_id'] - ) - ->addForeignKey( - $installer->getFkName($tableName, 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName($tableName, 'category_id', 'catalog_category_entity', 'entity_id'), - 'category_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName($tableName, 'url_rewrite_id', 'url_rewrite', 'url_rewrite_id'), - 'url_rewrite_id', - $installer->getTable('url_rewrite'), - 'url_rewrite_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('url_rewrite_relation'); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + $tableName = \Magento\CatalogUrlRewrite\Model\Resource\Category\Product::TABLE_NAME; + $table = $installer->getConnection() + ->newTable($installer->getTable($tableName)) + ->addColumn( + 'url_rewrite_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'url_rewrite_id' + ) + ->addColumn( + 'category_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'category_id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'product_id' + ) + ->addIndex( + $installer->getIdxName($tableName, ['category_id', 'product_id']), + ['category_id', 'product_id'] + ) + ->addForeignKey( + $installer->getFkName($tableName, 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName($tableName, 'category_id', 'catalog_category_entity', 'entity_id'), + 'category_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName($tableName, 'url_rewrite_id', 'url_rewrite', 'url_rewrite_id'), + 'url_rewrite_id', + $installer->getTable('url_rewrite'), + 'url_rewrite_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('url_rewrite_relation'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php index 86e6ac64fb8a1..dc81a8205e247 100644 --- a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php +++ b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'checkout_agreement' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('checkout_agreement') - )->addColumn( - 'agreement_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Agreement Id' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' - )->addColumn( - 'content', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Content' - )->addColumn( - 'content_height', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 25, - [], - 'Content Height' - )->addColumn( - 'checkbox_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Checkbox Text' - )->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Is Active' - )->addColumn( - 'is_html', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Is Html' - )->setComment( - 'Checkout Agreement' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'checkout_agreement_store' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('checkout_agreement_store') - )->addColumn( - 'agreement_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Agreement Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store Id' - )->addForeignKey( - $installer->getFkName('checkout_agreement_store', 'agreement_id', 'checkout_agreement', 'agreement_id'), - 'agreement_id', - $installer->getTable('checkout_agreement'), - 'agreement_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('checkout_agreement_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Checkout Agreement Store' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $installer->startSetup(); + + /** + * Create table 'checkout_agreement' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('checkout_agreement') + )->addColumn( + 'agreement_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Agreement Id' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'content', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Content' + )->addColumn( + 'content_height', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 25, + [], + 'Content Height' + )->addColumn( + 'checkbox_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Checkbox Text' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Is Active' + )->addColumn( + 'is_html', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Is Html' + )->setComment( + 'Checkout Agreement' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'checkout_agreement_store' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('checkout_agreement_store') + )->addColumn( + 'agreement_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Agreement Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store Id' + )->addForeignKey( + $installer->getFkName('checkout_agreement_store', 'agreement_id', 'checkout_agreement', 'agreement_id'), + 'agreement_id', + $installer->getTable('checkout_agreement'), + 'agreement_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('checkout_agreement_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Checkout Agreement Store' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Cms/Setup/InstallSchema.php b/app/code/Magento/Cms/Setup/InstallSchema.php index 18c8cb67d031a..6aab12de25ae7 100644 --- a/app/code/Magento/Cms/Setup/InstallSchema.php +++ b/app/code/Magento/Cms/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'cms_block' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('cms_block') - )->addColumn( - 'block_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Block ID' - )->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Block Title' - )->addColumn( - 'identifier', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Block String Identifier' - )->addColumn( - 'content', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Block Content' - )->addColumn( - 'creation_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Block Creation Time' - )->addColumn( - 'update_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Block Modification Time' - )->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Is Block Active' - )->setComment( - 'CMS Block Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'cms_block_store' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('cms_block_store') - )->addColumn( - 'block_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'primary' => true], - 'Block ID' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - )->addIndex( - $installer->getIdxName('cms_block_store', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('cms_block_store', 'block_id', 'cms_block', 'block_id'), - 'block_id', - $installer->getTable('cms_block'), - 'block_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('cms_block_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'CMS Block To Store Linkage Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'cms_page' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('cms_page') - )->addColumn( - 'page_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Page ID' - )->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Page Title' - )->addColumn( - 'page_layout', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Page Layout' - )->addColumn( - 'meta_keywords', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Page Meta Keywords' - )->addColumn( - 'meta_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Page Meta Description' - )->addColumn( - 'identifier', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['nullable' => true, 'default' => null], - 'Page String Identifier' - )->addColumn( - 'content_heading', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Page Content Heading' - )->addColumn( - 'content', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Page Content' - )->addColumn( - 'creation_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Page Creation Time' - )->addColumn( - 'update_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Page Modification Time' - )->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Is Page Active' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Page Sort Order' - )->addColumn( - 'layout_update_xml', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Page Layout Update Content' - )->addColumn( - 'custom_theme', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['nullable' => true], - 'Page Custom Theme' - )->addColumn( - 'custom_root_template', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Page Custom Template' - )->addColumn( - 'custom_layout_update_xml', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Page Custom Layout Update Content' - )->addColumn( - 'custom_theme_from', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => true], - 'Page Custom Theme Active From Date' - )->addColumn( - 'custom_theme_to', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => true], - 'Page Custom Theme Active To Date' - )->addIndex( - $installer->getIdxName('cms_page', ['identifier']), - ['identifier'] - )->setComment( - 'CMS Page Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'cms_page_store' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('cms_page_store') - )->addColumn( - 'page_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'primary' => true], - 'Page ID' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store ID' - )->addIndex( - $installer->getIdxName('cms_page_store', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('cms_page_store', 'page_id', 'cms_page', 'page_id'), - 'page_id', - $installer->getTable('cms_page'), - 'page_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('cms_page_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'CMS Page To Store Linkage Table' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'cms_block' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('cms_block') + )->addColumn( + 'block_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Block ID' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Block Title' + )->addColumn( + 'identifier', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Block String Identifier' + )->addColumn( + 'content', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Block Content' + )->addColumn( + 'creation_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Block Creation Time' + )->addColumn( + 'update_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Block Modification Time' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Is Block Active' + )->setComment( + 'CMS Block Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'cms_block_store' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('cms_block_store') + )->addColumn( + 'block_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'primary' => true], + 'Block ID' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + )->addIndex( + $installer->getIdxName('cms_block_store', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('cms_block_store', 'block_id', 'cms_block', 'block_id'), + 'block_id', + $installer->getTable('cms_block'), + 'block_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('cms_block_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'CMS Block To Store Linkage Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'cms_page' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('cms_page') + )->addColumn( + 'page_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Page ID' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Page Title' + )->addColumn( + 'page_layout', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Page Layout' + )->addColumn( + 'meta_keywords', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Page Meta Keywords' + )->addColumn( + 'meta_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Page Meta Description' + )->addColumn( + 'identifier', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['nullable' => true, 'default' => null], + 'Page String Identifier' + )->addColumn( + 'content_heading', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Page Content Heading' + )->addColumn( + 'content', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Page Content' + )->addColumn( + 'creation_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Page Creation Time' + )->addColumn( + 'update_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Page Modification Time' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Is Page Active' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Page Sort Order' + )->addColumn( + 'layout_update_xml', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Page Layout Update Content' + )->addColumn( + 'custom_theme', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['nullable' => true], + 'Page Custom Theme' + )->addColumn( + 'custom_root_template', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Page Custom Template' + )->addColumn( + 'custom_layout_update_xml', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Page Custom Layout Update Content' + )->addColumn( + 'custom_theme_from', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => true], + 'Page Custom Theme Active From Date' + )->addColumn( + 'custom_theme_to', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => true], + 'Page Custom Theme Active To Date' + )->addIndex( + $installer->getIdxName('cms_page', ['identifier']), + ['identifier'] + )->setComment( + 'CMS Page Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'cms_page_store' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('cms_page_store') + )->addColumn( + 'page_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'primary' => true], + 'Page ID' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + )->addIndex( + $installer->getIdxName('cms_page_store', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('cms_page_store', 'page_id', 'cms_page', 'page_id'), + 'page_id', + $installer->getTable('cms_page'), + 'page_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('cms_page_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'CMS Page To Store Linkage Table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php index 945081a1d454d..d9eb17cff25ab 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'catalog_product_super_attribute' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_super_attribute')) - ->addColumn( - 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product Super Attribute ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute ID' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Position' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_super_attribute', - ['product_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_id', 'attribute_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_super_attribute', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION - ) - ->setComment('Catalog Product Super Attribute Table'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_super_attribute_label' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_super_attribute_label')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Super Attribute ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'use_default', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Use Default Value' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value' - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_super_attribute_label', - ['product_super_attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_super_attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('catalog_product_super_attribute_label', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_super_attribute_label', - 'product_super_attribute_id', - 'catalog_product_super_attribute', - 'product_super_attribute_id' - ), - 'product_super_attribute_id', - $installer->getTable('catalog_product_super_attribute'), - 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_super_attribute_label', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Super Attribute Label Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_super_attribute_pricing' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_super_attribute_pricing')) - ->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value ID' - ) - ->addColumn( - 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Super Attribute ID' - ) - ->addColumn( - 'value_index', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Value Index' - ) - ->addColumn( - 'is_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Is Percent' - ) - ->addColumn( - 'pricing_value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Pricing Value' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website ID' - ) - ->addIndex( - $installer->getIdxName('catalog_product_super_attribute_pricing', ['website_id']), - ['website_id'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_super_attribute_pricing', - ['product_super_attribute_id', 'value_index', 'website_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_super_attribute_id', 'value_index', 'website_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_super_attribute_pricing', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'catalog_product_super_attribute_pricing', - 'product_super_attribute_id', - 'catalog_product_super_attribute', - 'product_super_attribute_id' - ), - 'product_super_attribute_id', - $installer->getTable('catalog_product_super_attribute'), - 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Super Attribute Pricing Table'); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_super_link' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_super_link')) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Link ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Parent ID' - ) - ->addIndex( - $installer->getIdxName('catalog_product_super_link', ['parent_id']), - ['parent_id'] - ) - ->addIndex( - $installer->getIdxName( - 'catalog_product_super_link', - ['product_id', 'parent_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_id', 'parent_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('catalog_product_super_link', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('catalog_product_super_link', 'parent_id', 'catalog_product_entity', 'entity_id'), - 'parent_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Catalog Product Super Link Table'); - - $installer->getConnection()->createTable($table); - - $table = $installer->getConnection() - ->addColumn( - $installer->getTable('catalog_eav_attribute'), - 'is_configurable', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 'unsigned' => true, - 'default' => null, - 'comment' => 'Can be used to create configurable product' - ] - ); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'catalog_product_super_attribute' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_super_attribute')) + ->addColumn( + 'product_super_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Super Attribute ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Position' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_super_attribute', + ['product_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_id', 'attribute_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_super_attribute', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + ) + ->setComment('Catalog Product Super Attribute Table'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_super_attribute_label' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_super_attribute_label')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_super_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Super Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'use_default', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Use Default Value' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_super_attribute_label', + ['product_super_attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_super_attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_super_attribute_label', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_super_attribute_label', + 'product_super_attribute_id', + 'catalog_product_super_attribute', + 'product_super_attribute_id' + ), + 'product_super_attribute_id', + $installer->getTable('catalog_product_super_attribute'), + 'product_super_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_super_attribute_label', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Super Attribute Label Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_super_attribute_pricing' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_super_attribute_pricing')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_super_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Super Attribute ID' + ) + ->addColumn( + 'value_index', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Value Index' + ) + ->addColumn( + 'is_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Is Percent' + ) + ->addColumn( + 'pricing_value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Pricing Value' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName('catalog_product_super_attribute_pricing', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_super_attribute_pricing', + ['product_super_attribute_id', 'value_index', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_super_attribute_id', 'value_index', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_super_attribute_pricing', + 'website_id', + 'store_website', + 'website_id' + ), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_super_attribute_pricing', + 'product_super_attribute_id', + 'catalog_product_super_attribute', + 'product_super_attribute_id' + ), + 'product_super_attribute_id', + $installer->getTable('catalog_product_super_attribute'), + 'product_super_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Super Attribute Pricing Table'); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_super_link' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_super_link')) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Parent ID' + ) + ->addIndex( + $installer->getIdxName('catalog_product_super_link', ['parent_id']), + ['parent_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_super_link', + ['product_id', 'parent_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_id', 'parent_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_super_link', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_super_link', 'parent_id', 'catalog_product_entity', 'entity_id'), + 'parent_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Super Link Table'); + + $installer->getConnection()->createTable($table); + + $table = $installer->getConnection() + ->addColumn( + $installer->getTable('catalog_eav_attribute'), + 'is_configurable', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 'unsigned' => true, + 'default' => null, + 'comment' => 'Can be used to create configurable product' + ] + ); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php index d2b18a87201d4..2b10dbb69ec9a 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php +++ b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php @@ -1,11 +1,8 @@ getVersion(), '2.0.1') <= 0) { $installer = $setup; - - $installer->startSetup(); + + $installer->startSetup(); $table = $installer->getConnection() ->dropColumn( @@ -32,5 +29,5 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } - } + } } \ No newline at end of file diff --git a/app/code/Magento/Core/Setup/InstallSchema.php b/app/code/Magento/Core/Setup/InstallSchema.php index 27446a24d6271..a745c183a23f2 100644 --- a/app/code/Magento/Core/Setup/InstallSchema.php +++ b/app/code/Magento/Core/Setup/InstallSchema.php @@ -1,11 +1,8 @@ getConnection(); - - $installer->startSetup(); - - /** - * Create table 'core_config_data' - */ - $table = $connection->newTable( - $installer->getTable('core_config_data') - )->addColumn( - 'config_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Config Id' - )->addColumn( - 'scope', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 8, - ['nullable' => false, 'default' => 'default'], - 'Config Scope' - )->addColumn( - 'scope_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Config Scope Id' - )->addColumn( - 'path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false, 'default' => 'general'], - 'Config Path' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Config Value' - )->addIndex( - $installer->getIdxName( - 'core_config_data', - ['scope', 'scope_id', 'path'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['scope', 'scope_id', 'path'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->setComment( - 'Config Data' - ); - $connection->createTable($table); - - /** - * Create table 'core_layout_update' - */ - $table = $connection->newTable( - $installer->getTable('core_layout_update') - )->addColumn( - 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Layout Update Id' - )->addColumn( - 'handle', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Handle' - )->addColumn( - 'xml', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Xml' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Last Update Timestamp' - )->addIndex( - $installer->getIdxName('core_layout_update', ['handle']), - ['handle'] - )->setComment( - 'Layout Updates' - ); - $connection->createTable($table); - - /** - * Create table 'core_layout_link' - */ - $table = $connection->newTable( - $installer->getTable('core_layout_link') - )->addColumn( - 'layout_link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Link Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'theme_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Theme id' - )->addColumn( - 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Layout Update Id' - )->addColumn( - 'is_temporary', - \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - null, - ['nullable' => false, 'default' => '0'], - 'Defines whether Layout Update is Temporary' - )->addIndex( - $installer->getIdxName('core_layout_link', ['layout_update_id']), - ['layout_update_id'] - )->addForeignKey( - $installer->getFkName('core_layout_link', 'layout_update_id', 'core_layout_update', 'layout_update_id'), - 'layout_update_id', - $installer->getTable('core_layout_update'), - 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addIndex( - $installer->getIdxName( - 'core_layout_link', - ['store_id', 'theme_id', 'layout_update_id', 'is_temporary'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['store_id', 'theme_id', 'layout_update_id', 'is_temporary'] - )->addForeignKey( - $installer->getFkName('core_layout_link', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('core_layout_link', 'theme_id', 'theme', 'theme_id'), - 'theme_id', - $installer->getTable('theme'), - 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Layout Link' - ); - $connection->createTable($table); - - /** - * Create table 'core_session' - */ - $table = $connection->newTable( - $installer->getTable('core_session') - )->addColumn( - 'session_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false, 'primary' => true], - 'Session Id' - )->addColumn( - 'session_expires', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Date of Session Expiration' - )->addColumn( - 'session_data', - \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, - '2M', - ['nullable' => false], - 'Session Data' - )->setComment( - 'Database Sessions Storage' - ); - $connection->createTable($table); - - /** - * Create table 'design_change' - */ - $table = $connection->newTable( - $installer->getTable('design_change') - )->addColumn( - 'design_change_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Design Change Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'design', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Design' - )->addColumn( - 'date_from', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'First Date of Design Activity' - )->addColumn( - 'date_to', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Last Date of Design Activity' - )->addIndex( - $installer->getIdxName('design_change', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('design_change', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Design Changes' - ); - $connection->createTable($table); - - /** - * Create table 'core_variable' - */ - $table = $connection->newTable( - $installer->getTable('core_variable') - )->addColumn( - 'variable_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Variable Id' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Variable Code' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Variable Name' - )->addIndex( - $installer->getIdxName( - 'core_variable', - ['code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->setComment( - 'Variables' - ); - $connection->createTable($table); - - /** - * Create table 'core_variable_value' - */ - $table = $connection->newTable( - $installer->getTable('core_variable_value') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Variable Value Id' - )->addColumn( - 'variable_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Variable Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'plain_value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Plain Text Value' - )->addColumn( - 'html_value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Html Value' - )->addIndex( - $installer->getIdxName( - 'core_variable_value', - ['variable_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['variable_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('core_variable_value', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('core_variable_value', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('core_variable_value', 'variable_id', 'core_variable', 'variable_id'), - 'variable_id', - $installer->getTable('core_variable'), - 'variable_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Variable Value' - ); - $connection->createTable($table); - - /** - * Create table 'core_cache' - */ - $table = $connection->newTable( - $installer->getTable('core_cache') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - ['nullable' => false, 'primary' => true], - 'Cache Id' - )->addColumn( - 'data', - \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, - '2M', - [], - 'Cache Data' - )->addColumn( - 'create_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Cache Creation Time' - )->addColumn( - 'update_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Time of Cache Updating' - )->addColumn( - 'expire_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Cache Expiration Time' - )->addIndex( - $installer->getIdxName('core_cache', ['expire_time']), - ['expire_time'] - )->setComment( - 'Caches' - ); - $connection->createTable($table); - - /** - * Create table 'core_cache_tag' - */ - $table = $connection->newTable( - $installer->getTable('core_cache_tag') - )->addColumn( - 'tag', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['nullable' => false, 'primary' => true], - 'Tag' - )->addColumn( - 'cache_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - ['nullable' => false, 'primary' => true], - 'Cache Id' - )->addIndex( - $installer->getIdxName('core_cache_tag', ['cache_id']), - ['cache_id'] - )->setComment( - 'Tag Caches' - ); - $connection->createTable($table); - - /** - * Create table 'core_flag' - */ - $table = $connection->newTable( - $installer->getTable('core_flag') - )->addColumn( - 'flag_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Flag Id' - )->addColumn( - 'flag_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Flag Code' - )->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Flag State' - )->addColumn( - 'flag_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Flag Data' - )->addColumn( - 'last_update', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], - 'Date of Last Flag Update' - )->addIndex( - $installer->getIdxName('core_flag', ['last_update']), - ['last_update'] - )->setComment( - 'Flag' - ); - $connection->createTable($table); - - /** - * Drop Foreign Key on core_cache_tag.cache_id - */ - $connection->dropForeignKey( - $installer->getTable('core_cache_tag'), - $installer->getFkName('core_cache_tag', 'cache_id', 'core_cache', 'id') - ); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + /* @var $connection \Magento\Framework\DB\Adapter\AdapterInterface */ + $connection = $installer->getConnection(); + + $installer->startSetup(); + + /** + * Create table 'core_config_data' + */ + $table = $connection->newTable( + $installer->getTable('core_config_data') + )->addColumn( + 'config_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Config Id' + )->addColumn( + 'scope', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 8, + ['nullable' => false, 'default' => 'default'], + 'Config Scope' + )->addColumn( + 'scope_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Config Scope Id' + )->addColumn( + 'path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false, 'default' => 'general'], + 'Config Path' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Config Value' + )->addIndex( + $installer->getIdxName( + 'core_config_data', + ['scope', 'scope_id', 'path'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['scope', 'scope_id', 'path'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->setComment( + 'Config Data' + ); + $connection->createTable($table); + + /** + * Create table 'core_layout_update' + */ + $table = $connection->newTable( + $installer->getTable('core_layout_update') + )->addColumn( + 'layout_update_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Layout Update Id' + )->addColumn( + 'handle', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Handle' + )->addColumn( + 'xml', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Xml' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Last Update Timestamp' + )->addIndex( + $installer->getIdxName('core_layout_update', ['handle']), + ['handle'] + )->setComment( + 'Layout Updates' + ); + $connection->createTable($table); + + /** + * Create table 'core_layout_link' + */ + $table = $connection->newTable( + $installer->getTable('core_layout_link') + )->addColumn( + 'layout_link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'theme_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Theme id' + )->addColumn( + 'layout_update_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Layout Update Id' + )->addColumn( + 'is_temporary', + \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, + null, + ['nullable' => false, 'default' => '0'], + 'Defines whether Layout Update is Temporary' + )->addIndex( + $installer->getIdxName('core_layout_link', ['layout_update_id']), + ['layout_update_id'] + )->addForeignKey( + $installer->getFkName('core_layout_link', 'layout_update_id', 'core_layout_update', 'layout_update_id'), + 'layout_update_id', + $installer->getTable('core_layout_update'), + 'layout_update_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addIndex( + $installer->getIdxName( + 'core_layout_link', + ['store_id', 'theme_id', 'layout_update_id', 'is_temporary'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['store_id', 'theme_id', 'layout_update_id', 'is_temporary'] + )->addForeignKey( + $installer->getFkName('core_layout_link', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('core_layout_link', 'theme_id', 'theme', 'theme_id'), + 'theme_id', + $installer->getTable('theme'), + 'theme_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Layout Link' + ); + $connection->createTable($table); + + /** + * Create table 'core_session' + */ + $table = $connection->newTable( + $installer->getTable('core_session') + )->addColumn( + 'session_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false, 'primary' => true], + 'Session Id' + )->addColumn( + 'session_expires', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Date of Session Expiration' + )->addColumn( + 'session_data', + \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, + '2M', + ['nullable' => false], + 'Session Data' + )->setComment( + 'Database Sessions Storage' + ); + $connection->createTable($table); + + /** + * Create table 'design_change' + */ + $table = $connection->newTable( + $installer->getTable('design_change') + )->addColumn( + 'design_change_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Design Change Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'design', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Design' + )->addColumn( + 'date_from', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'First Date of Design Activity' + )->addColumn( + 'date_to', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Last Date of Design Activity' + )->addIndex( + $installer->getIdxName('design_change', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('design_change', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Design Changes' + ); + $connection->createTable($table); + + /** + * Create table 'core_variable' + */ + $table = $connection->newTable( + $installer->getTable('core_variable') + )->addColumn( + 'variable_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Variable Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Variable Code' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Variable Name' + )->addIndex( + $installer->getIdxName( + 'core_variable', + ['code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->setComment( + 'Variables' + ); + $connection->createTable($table); + + /** + * Create table 'core_variable_value' + */ + $table = $connection->newTable( + $installer->getTable('core_variable_value') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Variable Value Id' + )->addColumn( + 'variable_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Variable Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'plain_value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Plain Text Value' + )->addColumn( + 'html_value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Html Value' + )->addIndex( + $installer->getIdxName( + 'core_variable_value', + ['variable_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['variable_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('core_variable_value', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('core_variable_value', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('core_variable_value', 'variable_id', 'core_variable', 'variable_id'), + 'variable_id', + $installer->getTable('core_variable'), + 'variable_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Variable Value' + ); + $connection->createTable($table); + + /** + * Create table 'core_cache' + */ + $table = $connection->newTable( + $installer->getTable('core_cache') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + ['nullable' => false, 'primary' => true], + 'Cache Id' + )->addColumn( + 'data', + \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, + '2M', + [], + 'Cache Data' + )->addColumn( + 'create_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Cache Creation Time' + )->addColumn( + 'update_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Time of Cache Updating' + )->addColumn( + 'expire_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Cache Expiration Time' + )->addIndex( + $installer->getIdxName('core_cache', ['expire_time']), + ['expire_time'] + )->setComment( + 'Caches' + ); + $connection->createTable($table); + + /** + * Create table 'core_cache_tag' + */ + $table = $connection->newTable( + $installer->getTable('core_cache_tag') + )->addColumn( + 'tag', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['nullable' => false, 'primary' => true], + 'Tag' + )->addColumn( + 'cache_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + ['nullable' => false, 'primary' => true], + 'Cache Id' + )->addIndex( + $installer->getIdxName('core_cache_tag', ['cache_id']), + ['cache_id'] + )->setComment( + 'Tag Caches' + ); + $connection->createTable($table); + + /** + * Create table 'core_flag' + */ + $table = $connection->newTable( + $installer->getTable('core_flag') + )->addColumn( + 'flag_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Flag Id' + )->addColumn( + 'flag_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Flag Code' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Flag State' + )->addColumn( + 'flag_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Flag Data' + )->addColumn( + 'last_update', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], + 'Date of Last Flag Update' + )->addIndex( + $installer->getIdxName('core_flag', ['last_update']), + ['last_update'] + )->setComment( + 'Flag' + ); + $connection->createTable($table); + + /** + * Drop Foreign Key on core_cache_tag.cache_id + */ + $connection->dropForeignKey( + $installer->getTable('core_cache_tag'), + $installer->getFkName('core_cache_tag', 'cache_id', 'core_cache', 'id') + ); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Cron/Setup/InstallSchema.php b/app/code/Magento/Cron/Setup/InstallSchema.php index b45529f924243..e496810e84809 100644 --- a/app/code/Magento/Cron/Setup/InstallSchema.php +++ b/app/code/Magento/Cron/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'cron_schedule' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('cron_schedule') - )->addColumn( - 'schedule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Schedule Id' - )->addColumn( - 'job_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false, 'default' => '0'], - 'Job Code' - )->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 7, - ['nullable' => false, 'default' => 'pending'], - 'Status' - )->addColumn( - 'messages', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Messages' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Created At' - )->addColumn( - 'scheduled_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Scheduled At' - )->addColumn( - 'executed_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Executed At' - )->addColumn( - 'finished_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Finished At' - )->addIndex( - $installer->getIdxName('cron_schedule', ['job_code']), - ['job_code'] - )->addIndex( - $installer->getIdxName('cron_schedule', ['scheduled_at', 'status']), - ['scheduled_at', 'status'] - )->setComment( - 'Cron Schedule' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'cron_schedule' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('cron_schedule') + )->addColumn( + 'schedule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Schedule Id' + )->addColumn( + 'job_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false, 'default' => '0'], + 'Job Code' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 7, + ['nullable' => false, 'default' => 'pending'], + 'Status' + )->addColumn( + 'messages', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Messages' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Created At' + )->addColumn( + 'scheduled_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Scheduled At' + )->addColumn( + 'executed_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Executed At' + )->addColumn( + 'finished_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Finished At' + )->addIndex( + $installer->getIdxName('cron_schedule', ['job_code']), + ['job_code'] + )->addIndex( + $installer->getIdxName('cron_schedule', ['scheduled_at', 'status']), + ['scheduled_at', 'status'] + )->setComment( + 'Cron Schedule' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Customer/Setup/InstallSchema.php b/app/code/Magento/Customer/Setup/InstallSchema.php index 2b1b5bd5fb85f..7fec5ae30cde6 100644 --- a/app/code/Magento/Customer/Setup/InstallSchema.php +++ b/app/code/Magento/Customer/Setup/InstallSchema.php @@ -1,8 +1,8 @@ addForeignKey( - $installer->getFkName('customer_address_entity_decimal', 'entity_id', 'customer_address_entity', 'entity_id'), + $installer->getFkName('customer_address_entity_decimal', + 'entity_id', + 'customer_address_entity', + 'entity_id' + ), 'entity_id', $installer->getTable('customer_address_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('customer_address_entity_decimal', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), + $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', diff --git a/app/code/Magento/Customer/Setup/UpgradeSchema.php b/app/code/Magento/Customer/Setup/UpgradeSchema.php index d70a46738543c..6fd309092af77 100644 --- a/app/code/Magento/Customer/Setup/UpgradeSchema.php +++ b/app/code/Magento/Customer/Setup/UpgradeSchema.php @@ -1,8 +1,8 @@ startSetup(); - $connection = $installer->getConnection(); - - /** - * Create table 'vde_theme_change' - */ - $table = $installer->getConnection()->newTable( - $installer->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( - $installer->getFkName('vde_theme_change', 'theme_id', 'theme', 'theme_id'), - 'theme_id', - $installer->getTable('theme'), - 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Design Editor Theme Change' - ); - - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + $connection = $installer->getConnection(); + + /** + * Create table 'vde_theme_change' + */ + $table = $installer->getConnection()->newTable( + $installer->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( + $installer->getFkName('vde_theme_change', 'theme_id', 'theme', 'theme_id'), + 'theme_id', + $installer->getTable('theme'), + 'theme_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Design Editor Theme Change' + ); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Directory/Setup/InstallSchema.php b/app/code/Magento/Directory/Setup/InstallSchema.php index 0fe48779e6884..9c1b2f604ed4e 100644 --- a/app/code/Magento/Directory/Setup/InstallSchema.php +++ b/app/code/Magento/Directory/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'directory_country' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('directory_country') - )->addColumn( - 'country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - ['nullable' => false, 'primary' => true, 'default' => false], - 'Country Id in ISO-2' - )->addColumn( - 'iso2_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - ['nullable' => true, 'default' => null], - 'Country ISO-2 format' - )->addColumn( - 'iso3_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - ['nullable' => true, 'default' => null], - 'Country ISO-3' - )->setComment( - 'Directory Country' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'directory_country_format' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('directory_country_format') - )->addColumn( - 'country_format_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Country Format Id' - )->addColumn( - 'country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - ['nullable' => true, 'default' => null], - 'Country Id in ISO-2' - )->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 30, - ['nullable' => true, 'default' => null], - 'Country Format Type' - )->addColumn( - 'format', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Country Format' - )->addIndex( - $installer->getIdxName( - 'directory_country_format', - ['country_id', 'type'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['country_id', 'type'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->setComment( - 'Directory Country Format' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'directory_country_region' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('directory_country_region') - )->addColumn( - 'region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Region Id' - )->addColumn( - 'country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 4, - ['nullable' => false, 'default' => '0'], - 'Country Id in ISO-2' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true, 'default' => null], - 'Region code' - )->addColumn( - 'default_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Region Name' - )->addIndex( - $installer->getIdxName('directory_country_region', ['country_id']), - ['country_id'] - )->setComment( - 'Directory Country Region' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'directory_country_region_name' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('directory_country_region_name') - )->addColumn( - 'locale', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 8, - ['nullable' => false, 'primary' => true, 'default' => false], - 'Locale' - )->addColumn( - 'region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Region Id' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Region Name' - )->addIndex( - $installer->getIdxName('directory_country_region_name', ['region_id']), - ['region_id'] - )->addForeignKey( - $installer->getFkName('directory_country_region_name', 'region_id', 'directory_country_region', 'region_id'), - 'region_id', - $installer->getTable('directory_country_region'), - 'region_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Directory Country Region Name' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'directory_currency_rate' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('directory_currency_rate') - )->addColumn( - 'currency_from', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - ['nullable' => false, 'primary' => true, 'default' => false], - 'Currency Code Convert From' - )->addColumn( - 'currency_to', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - ['nullable' => false, 'primary' => true, 'default' => false], - 'Currency Code Convert To' - )->addColumn( - 'rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '24,12', - ['nullable' => false, 'default' => '0.000000000000'], - 'Currency Conversion Rate' - )->addIndex( - $installer->getIdxName('directory_currency_rate', ['currency_to']), - ['currency_to'] - )->setComment( - 'Directory Currency Rate' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'directory_country' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('directory_country') + )->addColumn( + 'country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + ['nullable' => false, 'primary' => true, 'default' => false], + 'Country Id in ISO-2' + )->addColumn( + 'iso2_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + ['nullable' => true, 'default' => null], + 'Country ISO-2 format' + )->addColumn( + 'iso3_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + ['nullable' => true, 'default' => null], + 'Country ISO-3' + )->setComment( + 'Directory Country' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'directory_country_format' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('directory_country_format') + )->addColumn( + 'country_format_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Country Format Id' + )->addColumn( + 'country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + ['nullable' => true, 'default' => null], + 'Country Id in ISO-2' + )->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 30, + ['nullable' => true, 'default' => null], + 'Country Format Type' + )->addColumn( + 'format', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Country Format' + )->addIndex( + $installer->getIdxName( + 'directory_country_format', + ['country_id', 'type'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['country_id', 'type'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->setComment( + 'Directory Country Format' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'directory_country_region' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('directory_country_region') + )->addColumn( + 'region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Region Id' + )->addColumn( + 'country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 4, + ['nullable' => false, 'default' => '0'], + 'Country Id in ISO-2' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Region code' + )->addColumn( + 'default_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Region Name' + )->addIndex( + $installer->getIdxName('directory_country_region', ['country_id']), + ['country_id'] + )->setComment( + 'Directory Country Region' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'directory_country_region_name' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('directory_country_region_name') + )->addColumn( + 'locale', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 8, + ['nullable' => false, 'primary' => true, 'default' => false], + 'Locale' + )->addColumn( + 'region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Region Id' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Region Name' + )->addIndex( + $installer->getIdxName('directory_country_region_name', ['region_id']), + ['region_id'] + )->addForeignKey( + $installer->getFkName('directory_country_region_name', + 'region_id', + 'directory_country_region', + 'region_id' + ), + 'region_id', + $installer->getTable('directory_country_region'), + 'region_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Directory Country Region Name' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'directory_currency_rate' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('directory_currency_rate') + )->addColumn( + 'currency_from', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + ['nullable' => false, 'primary' => true, 'default' => false], + 'Currency Code Convert From' + )->addColumn( + 'currency_to', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + ['nullable' => false, 'primary' => true, 'default' => false], + 'Currency Code Convert To' + )->addColumn( + 'rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '24,12', + ['nullable' => false, 'default' => '0.000000000000'], + 'Currency Conversion Rate' + )->addIndex( + $installer->getIdxName('directory_currency_rate', ['currency_to']), + ['currency_to'] + )->setComment( + 'Directory Currency Rate' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Downloadable/Setup/InstallSchema.php b/app/code/Magento/Downloadable/Setup/InstallSchema.php index 525763ab8042b..2befaff02d9f7 100644 --- a/app/code/Magento/Downloadable/Setup/InstallSchema.php +++ b/app/code/Magento/Downloadable/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'downloadable_link' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_link')) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Link ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort order' - ) - ->addColumn( - 'number_of_downloads', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => true], - 'Number of downloads' - ) - ->addColumn( - 'is_shareable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Shareable flag' - ) - ->addColumn( - 'link_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link Url' - ) - ->addColumn( - 'link_file', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link File' - ) - ->addColumn( - 'link_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - [], - 'Link Type' - ) - ->addColumn( - 'sample_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sample Url' - ) - ->addColumn( - 'sample_file', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sample File' - ) - ->addColumn( - 'sample_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - [], - 'Sample Type' - ) - ->addIndex( - $installer->getIdxName('downloadable_link', ['product_id', 'sort_order']), - ['product_id', 'sort_order'] - ) - ->addForeignKey( - $installer->getFkName('downloadable_link', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Link Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'downloadable_link_price' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_link_price')) - ->addColumn( - 'price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Price ID' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Link ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website ID' - ) - ->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_price', 'link_id'), - 'link_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_price', 'link_id', 'downloadable_link', 'link_id'), - 'link_id', - $installer->getTable('downloadable_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $installer->getIdxName('downloadable_link_price', 'website_id'), - 'website_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Link Price Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'downloadable_link_purchased' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_link_purchased')) - ->addColumn( - 'purchased_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Purchased ID' - ) - ->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Order ID' - ) - ->addColumn( - 'order_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Increment ID' - ) - ->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Order Item ID' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Date of creation' - ) - ->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Date of modification' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true, 'default' => '0'], - 'Customer ID' - ) - ->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Product name' - ) - ->addColumn( - 'product_sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Product sku' - ) - ->addColumn( - 'link_section_title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link_section_title' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased', 'order_id'), - 'order_id' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased', 'order_item_id'), - 'order_item_id' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased', 'customer_id'), - 'customer_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_purchased', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_purchased', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Link Purchased Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'downloadable_link_purchased_item' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_link_purchased_item')) - ->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Item ID' - ) - ->addColumn( - 'purchased_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Purchased ID' - ) - ->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Order Item ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'link_hash', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link hash' - ) - ->addColumn( - 'number_of_downloads_bought', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Number of downloads bought' - ) - ->addColumn( - 'number_of_downloads_used', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Number of downloads used' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Link ID' - ) - ->addColumn( - 'link_title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link Title' - ) - ->addColumn( - 'is_shareable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Shareable Flag' - ) - ->addColumn( - 'link_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link Url' - ) - ->addColumn( - 'link_file', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link File' - ) - ->addColumn( - 'link_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Link Type' - ) - ->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Status' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Creation Time' - ) - ->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Update Time' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased_item', 'link_hash'), - 'link_hash' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased_item', 'order_item_id'), - 'order_item_id' - ) - ->addIndex( - $installer->getIdxName('downloadable_link_purchased_item', 'purchased_id'), - 'purchased_id' - ) - ->addForeignKey( - $installer->getFkName( - 'downloadable_link_purchased_item', - 'purchased_id', - 'downloadable_link_purchased', - 'purchased_id' - ), - 'purchased_id', - $installer->getTable('downloadable_link_purchased'), - 'purchased_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_purchased_item', 'order_item_id', 'sales_order_item', 'item_id'), - 'order_item_id', - $installer->getTable('sales_order_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Link Purchased Item Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'downloadable_link_title' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_link_title')) - ->addColumn( - 'title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Title ID' - ) - ->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Link ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Title' - ) - ->addIndex( - $installer->getIdxName( - 'downloadable_link_title', - ['link_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['link_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_title', 'link_id', 'downloadable_link', 'link_id'), - 'link_id', - $installer->getTable('downloadable_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $installer->getIdxName('downloadable_link_title', 'store_id'), - 'store_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_link_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Link Title Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'downloadable_sample' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_sample')) - ->addColumn( - 'sample_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Sample ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - ) - ->addColumn( - 'sample_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sample URL' - ) - ->addColumn( - 'sample_file', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sample file' - ) - ->addColumn( - 'sample_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - [], - 'Sample Type' - ) - ->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - ) - ->addIndex( - $installer->getIdxName('downloadable_sample', 'product_id'), - 'product_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_sample', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Sample Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'downloadable_sample_title' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('downloadable_sample_title')) - ->addColumn( - 'title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Title ID' - ) - ->addColumn( - 'sample_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sample ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Title' - ) - ->addIndex( - $installer->getIdxName( - 'downloadable_sample_title', - ['sample_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['sample_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('downloadable_sample_title', 'sample_id', 'downloadable_sample', 'sample_id'), - 'sample_id', - $installer->getTable('downloadable_sample'), - 'sample_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $installer->getIdxName('downloadable_sample_title', 'store_id'), - 'store_id' - ) - ->addForeignKey( - $installer->getFkName('downloadable_sample_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Downloadable Sample Title Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_index_price_downlod_idx' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_downlod_idx')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Minimum price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Maximum price' - ) - ->setComment('Indexer Table for price of downloadable products'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'catalog_product_index_price_downlod_tmp' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalog_product_index_price_downlod_tmp')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group ID' - ) - ->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website ID' - ) - ->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Minimum price' - ) - ->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Maximum price' - ) - ->setOption( - 'type', - \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY - ) - ->setComment('Temporary Indexer Table for price of downloadable products'); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'downloadable_link' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_link')) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort order' + ) + ->addColumn( + 'number_of_downloads', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => true], + 'Number of downloads' + ) + ->addColumn( + 'is_shareable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Shareable flag' + ) + ->addColumn( + 'link_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link Url' + ) + ->addColumn( + 'link_file', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link File' + ) + ->addColumn( + 'link_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + [], + 'Link Type' + ) + ->addColumn( + 'sample_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sample Url' + ) + ->addColumn( + 'sample_file', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sample File' + ) + ->addColumn( + 'sample_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + [], + 'Sample Type' + ) + ->addIndex( + $installer->getIdxName('downloadable_link', ['product_id', 'sort_order']), + ['product_id', 'sort_order'] + ) + ->addForeignKey( + $installer->getFkName('downloadable_link', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Link Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_link_price' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_link_price')) + ->addColumn( + 'price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Price ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_price', 'link_id'), + 'link_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_price', 'link_id', 'downloadable_link', 'link_id'), + 'link_id', + $installer->getTable('downloadable_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addIndex( + $installer->getIdxName('downloadable_link_price', 'website_id'), + 'website_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Link Price Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_link_purchased' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_link_purchased')) + ->addColumn( + 'purchased_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Purchased ID' + ) + ->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Order ID' + ) + ->addColumn( + 'order_increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Increment ID' + ) + ->addColumn( + 'order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Order Item ID' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Date of creation' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Date of modification' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true, 'default' => '0'], + 'Customer ID' + ) + ->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Product name' + ) + ->addColumn( + 'product_sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Product sku' + ) + ->addColumn( + 'link_section_title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link_section_title' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased', 'order_id'), + 'order_id' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased', 'order_item_id'), + 'order_item_id' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased', 'customer_id'), + 'customer_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_purchased', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_purchased', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Link Purchased Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_link_purchased_item' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_link_purchased_item')) + ->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Item ID' + ) + ->addColumn( + 'purchased_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Purchased ID' + ) + ->addColumn( + 'order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Order Item ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'link_hash', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link hash' + ) + ->addColumn( + 'number_of_downloads_bought', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Number of downloads bought' + ) + ->addColumn( + 'number_of_downloads_used', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Number of downloads used' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link ID' + ) + ->addColumn( + 'link_title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link Title' + ) + ->addColumn( + 'is_shareable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Shareable Flag' + ) + ->addColumn( + 'link_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link Url' + ) + ->addColumn( + 'link_file', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link File' + ) + ->addColumn( + 'link_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Link Type' + ) + ->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Status' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Creation Time' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Update Time' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased_item', 'link_hash'), + 'link_hash' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased_item', 'order_item_id'), + 'order_item_id' + ) + ->addIndex( + $installer->getIdxName('downloadable_link_purchased_item', 'purchased_id'), + 'purchased_id' + ) + ->addForeignKey( + $installer->getFkName( + 'downloadable_link_purchased_item', + 'purchased_id', + 'downloadable_link_purchased', + 'purchased_id' + ), + 'purchased_id', + $installer->getTable('downloadable_link_purchased'), + 'purchased_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_purchased_item', + 'order_item_id', + 'sales_order_item', + 'item_id' + ), + 'order_item_id', + $installer->getTable('sales_order_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Link Purchased Item Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_link_title' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_link_title')) + ->addColumn( + 'title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Title ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'downloadable_link_title', + ['link_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['link_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_title', 'link_id', 'downloadable_link', 'link_id'), + 'link_id', + $installer->getTable('downloadable_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addIndex( + $installer->getIdxName('downloadable_link_title', 'store_id'), + 'store_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_link_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Link Title Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_sample' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_sample')) + ->addColumn( + 'sample_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Sample ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'sample_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sample URL' + ) + ->addColumn( + 'sample_file', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sample file' + ) + ->addColumn( + 'sample_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + [], + 'Sample Type' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addIndex( + $installer->getIdxName('downloadable_sample', 'product_id'), + 'product_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_sample', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Sample Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'downloadable_sample_title' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('downloadable_sample_title')) + ->addColumn( + 'title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Title ID' + ) + ->addColumn( + 'sample_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sample ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'downloadable_sample_title', + ['sample_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['sample_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('downloadable_sample_title', 'sample_id', 'downloadable_sample', 'sample_id'), + 'sample_id', + $installer->getTable('downloadable_sample'), + 'sample_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addIndex( + $installer->getIdxName('downloadable_sample_title', 'store_id'), + 'store_id' + ) + ->addForeignKey( + $installer->getFkName('downloadable_sample_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Downloadable Sample Title Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_downlod_idx' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_downlod_idx')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Minimum price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Maximum price' + ) + ->setComment('Indexer Table for price of downloadable products'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'catalog_product_index_price_downlod_tmp' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_index_price_downlod_tmp')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Minimum price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Maximum price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment('Temporary Indexer Table for price of downloadable products'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Eav/Setup/InstallSchema.php b/app/code/Magento/Eav/Setup/InstallSchema.php index 5cf809d9ce0fc..68ec4e4b10f8e 100644 --- a/app/code/Magento/Eav/Setup/InstallSchema.php +++ b/app/code/Magento/Eav/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'eav_entity_type' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_type') - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Type Id' - )->addColumn( - 'entity_type_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false], - 'Entity Type Code' - )->addColumn( - 'entity_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Entity Model' - )->addColumn( - 'attribute_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Attribute Model' - )->addColumn( - 'entity_table', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Entity Table' - )->addColumn( - 'value_table_prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Value Table Prefix' - )->addColumn( - 'entity_id_field', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Entity Id Field' - )->addColumn( - 'is_data_sharing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Defines Is Data Sharing' - )->addColumn( - 'data_sharing_key', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['default' => 'default'], - 'Data Sharing Key' - )->addColumn( - 'default_attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Default Attribute Set Id' - )->addColumn( - 'increment_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => false], - 'Increment Model' - )->addColumn( - 'increment_per_store', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Increment Per Store' - )->addColumn( - 'increment_pad_length', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '8'], - 'Increment Pad Length' - )->addColumn( - 'increment_pad_char', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 1, - ['nullable' => false, 'default' => '0'], - 'Increment Pad Char' - )->addColumn( - 'additional_attribute_table', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => false], - 'Additional Attribute Table' - )->addColumn( - 'entity_attribute_collection', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Entity Attribute Collection' - )->addIndex( - $installer->getIdxName('eav_entity_type', ['entity_type_code']), - ['entity_type_code'] - )->setComment( - 'Eav Entity Type' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_entity' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - 50, - ['nullable' => true, 'default' => null], - 'Increment Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Parent Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Updated At' - )->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Defines Is Entity Active' - )->addIndex( - $installer->getIdxName('eav_entity', ['entity_type_id']), - ['entity_type_id'] - )->addIndex( - $installer->getIdxName('eav_entity', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_entity', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Entity' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_entity_datetime' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_datetime') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - ['nullable' => true, 'default' => null], - 'Attribute Value' - )->addIndex( - $installer->getIdxName('eav_entity_datetime', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('eav_entity_datetime', ['attribute_id', 'value']), - ['attribute_id', 'value'] - )->addIndex( - $installer->getIdxName('eav_entity_datetime', ['entity_type_id', 'value']), - ['entity_type_id', 'value'] - )->addIndex( - $installer->getIdxName( - 'eav_entity_datetime', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('eav_entity_datetime', 'entity_id', 'eav_entity', 'entity_id'), - 'entity_id', - $installer->getTable('eav_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_entity_datetime', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Entity Value Prefix' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_entity_decimal' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_decimal') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Attribute Value' - )->addIndex( - $installer->getIdxName('eav_entity_decimal', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('eav_entity_decimal', ['attribute_id', 'value']), - ['attribute_id', 'value'] - )->addIndex( - $installer->getIdxName('eav_entity_decimal', ['entity_type_id', 'value']), - ['entity_type_id', 'value'] - )->addIndex( - $installer->getIdxName( - 'eav_entity_decimal', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('eav_entity_decimal', 'entity_id', 'eav_entity', 'entity_id'), - 'entity_id', - $installer->getTable('eav_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_entity_decimal', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Entity Value Prefix' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_entity_int' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_int') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Attribute Value' - )->addIndex( - $installer->getIdxName('eav_entity_int', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('eav_entity_int', ['attribute_id', 'value']), - ['attribute_id', 'value'] - )->addIndex( - $installer->getIdxName('eav_entity_int', ['entity_type_id', 'value']), - ['entity_type_id', 'value'] - )->addIndex( - $installer->getIdxName( - 'eav_entity_int', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('eav_entity_int', 'entity_id', 'eav_entity', 'entity_id'), - 'entity_id', - $installer->getTable('eav_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_entity_int', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Entity Value Prefix' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_entity_text' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_text') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Attribute Value' - )->addIndex( - $installer->getIdxName('eav_entity_text', ['entity_type_id']), - ['entity_type_id'] - )->addIndex( - $installer->getIdxName('eav_entity_text', ['attribute_id']), - ['attribute_id'] - )->addIndex( - $installer->getIdxName('eav_entity_text', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName( - 'eav_entity_text', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('eav_entity_text', 'entity_id', 'eav_entity', 'entity_id'), - 'entity_id', - $installer->getTable('eav_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_entity_text', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Entity Value Prefix' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_entity_varchar' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_varchar') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 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, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Attribute Value' - )->addIndex( - $installer->getIdxName('eav_entity_varchar', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('eav_entity_varchar', ['attribute_id', 'value']), - ['attribute_id', 'value'] - )->addIndex( - $installer->getIdxName('eav_entity_varchar', ['entity_type_id', 'value']), - ['entity_type_id', 'value'] - )->addIndex( - $installer->getIdxName( - 'eav_entity_varchar', - ['entity_id', 'attribute_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_id', 'attribute_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('eav_entity_varchar', 'entity_id', 'eav_entity', 'entity_id'), - 'entity_id', - $installer->getTable('eav_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_entity_varchar', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Entity Value Prefix' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_attribute' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute') - )->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' - )->addColumn( - 'attribute_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Attribute Code' - )->addColumn( - 'attribute_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Attribute Model' - )->addColumn( - 'backend_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Backend Model' - )->addColumn( - 'backend_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 8, - ['nullable' => false, 'default' => 'static'], - 'Backend Type' - )->addColumn( - 'backend_table', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Backend Table' - )->addColumn( - 'frontend_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Frontend Model' - )->addColumn( - 'frontend_input', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Frontend Input' - )->addColumn( - 'frontend_label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Frontend Label' - )->addColumn( - 'frontend_class', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Frontend Class' - )->addColumn( - 'source_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Source Model' - )->addColumn( - 'is_required', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Defines Is Required' - )->addColumn( - 'is_user_defined', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Defines Is User Defined' - )->addColumn( - 'default_value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Default Value' - )->addColumn( - 'is_unique', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Defines Is Unique' - )->addColumn( - 'note', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Note' - )->addIndex( - $installer->getIdxName( - 'eav_attribute', - ['entity_type_id', 'attribute_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'attribute_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('eav_attribute', '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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Attribute' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_entity_store' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_store') - )->addColumn( - 'entity_store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Store Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'increment_prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - ['nullable' => true], - 'Increment Prefix' - )->addColumn( - 'increment_last_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => true], - 'Last Incremented Id' - )->addIndex( - $installer->getIdxName('eav_entity_store', ['entity_type_id']), - ['entity_type_id'] - )->addIndex( - $installer->getIdxName('eav_entity_store', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('eav_entity_store', '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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_entity_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Entity Store' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_attribute_set' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute_set') - )->addColumn( - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Set 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_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Attribute Set Name' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' - )->addIndex( - $installer->getIdxName( - 'eav_attribute_set', - ['entity_type_id', 'attribute_set_name'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_type_id', 'attribute_set_name'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('eav_attribute_set', ['entity_type_id', 'sort_order']), - ['entity_type_id', 'sort_order'] - )->addForeignKey( - $installer->getFkName('eav_attribute_set', '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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Attribute Set' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_attribute_group' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute_group') - )->addColumn( - 'attribute_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Group Id' - )->addColumn( - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Set Id' - )->addColumn( - 'attribute_group_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Attribute Group Name' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' - )->addColumn( - 'default_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Default Id' - )->addColumn( - 'attribute_group_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['default' => null], - 'Attribute Group Code' - )->addColumn( - 'tab_group_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['default' => null], - 'Tab Group Code' - )->addIndex( - $installer->getIdxName( - 'eav_attribute_group', - ['attribute_set_id', 'attribute_group_name'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['attribute_set_id', 'attribute_group_name'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('eav_attribute_group', ['attribute_set_id', 'sort_order']), - ['attribute_set_id', 'sort_order'] - )->addForeignKey( - $installer->getFkName('eav_attribute_group', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), - 'attribute_set_id', - $installer->getTable('eav_attribute_set'), - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Attribute Group' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_entity_attribute' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_entity_attribute') - )->addColumn( - 'entity_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Attribute 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( - 'attribute_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Group Id' - )->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' - )->addIndex( - $installer->getIdxName( - 'eav_entity_attribute', - ['attribute_set_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['attribute_set_id', 'attribute_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName( - 'eav_entity_attribute', - ['attribute_group_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['attribute_group_id', 'attribute_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('eav_entity_attribute', ['attribute_set_id', 'sort_order']), - ['attribute_set_id', 'sort_order'] - )->addIndex( - $installer->getIdxName('eav_entity_attribute', ['attribute_id']), - ['attribute_id'] - )->addForeignKey( - $installer->getFkName('eav_entity_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_entity_attribute', 'attribute_group_id', 'eav_attribute_group', 'attribute_group_id'), - 'attribute_group_id', - $installer->getTable('eav_attribute_group'), - 'attribute_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Entity Attributes' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_attribute_option' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute_option') - )->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Id' - )->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - )->addIndex( - $installer->getIdxName('eav_attribute_option', ['attribute_id']), - ['attribute_id'] - )->addForeignKey( - $installer->getFkName('eav_attribute_option', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Attribute Option' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_attribute_option_value' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute_option_value') - )->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Value Id' - )->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Option Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Value' - )->addIndex( - $installer->getIdxName('eav_attribute_option_value', ['option_id']), - ['option_id'] - )->addIndex( - $installer->getIdxName('eav_attribute_option_value', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('eav_attribute_option_value', 'option_id', 'eav_attribute_option', 'option_id'), - 'option_id', - $installer->getTable('eav_attribute_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_attribute_option_value', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Attribute Option Value' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_attribute_label' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_attribute_label') - )->addColumn( - 'attribute_label_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Label Id' - )->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Value' - )->addIndex( - $installer->getIdxName('eav_attribute_label', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('eav_attribute_label', ['attribute_id', 'store_id']), - ['attribute_id', 'store_id'] - )->addForeignKey( - $installer->getFkName('eav_attribute_label', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_attribute_label', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Attribute Label' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_form_type' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_form_type') - )->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Type Id' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => false], - 'Code' - )->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Label' - )->addColumn( - 'is_system', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is System' - )->addColumn( - 'theme', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => true], - 'Theme' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' - )->addIndex( - $installer->getIdxName( - 'eav_form_type', - ['code', 'theme', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['code', 'theme', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('eav_form_type', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('eav_form_type', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Form Type' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_form_type_entity' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_form_type_entity') - )->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Type Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Type Id' - )->addIndex( - $installer->getIdxName('eav_form_type_entity', ['entity_type_id']), - ['entity_type_id'] - )->addForeignKey( - $installer->getFkName('eav_form_type_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, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_form_type_entity', 'type_id', 'eav_form_type', 'type_id'), - 'type_id', - $installer->getTable('eav_form_type'), - 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Form Type Entity' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_form_fieldset' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_form_fieldset') - )->addColumn( - 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Fieldset Id' - )->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Type Id' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => false], - 'Code' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' - )->addIndex( - $installer->getIdxName( - 'eav_form_fieldset', - ['type_id', 'code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['type_id', 'code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('eav_form_fieldset', 'type_id', 'eav_form_type', 'type_id'), - 'type_id', - $installer->getTable('eav_form_type'), - 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Form Fieldset' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_form_fieldset_label' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_form_fieldset_label') - )->addColumn( - 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Fieldset Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store Id' - )->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Label' - )->addIndex( - $installer->getIdxName('eav_form_fieldset_label', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('eav_form_fieldset_label', 'fieldset_id', 'eav_form_fieldset', 'fieldset_id'), - 'fieldset_id', - $installer->getTable('eav_form_fieldset'), - 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_form_fieldset_label', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Form Fieldset Label' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'eav_form_element' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('eav_form_element') - )->addColumn( - 'element_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Element Id' - )->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Type Id' - )->addColumn( - 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Fieldset Id' - )->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Attribute Id' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Sort Order' - )->addIndex( - $installer->getIdxName( - 'eav_form_element', - ['type_id', 'attribute_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['type_id', 'attribute_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('eav_form_element', ['fieldset_id']), - ['fieldset_id'] - )->addIndex( - $installer->getIdxName('eav_form_element', ['attribute_id']), - ['attribute_id'] - )->addForeignKey( - $installer->getFkName('eav_form_element', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_form_element', 'fieldset_id', 'eav_form_fieldset', 'fieldset_id'), - 'fieldset_id', - $installer->getTable('eav_form_fieldset'), - 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('eav_form_element', 'type_id', 'eav_form_type', 'type_id'), - 'type_id', - $installer->getTable('eav_form_type'), - 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Eav Form Element' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'eav_entity_type' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_type') + )->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Type Id' + )->addColumn( + 'entity_type_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false], + 'Entity Type Code' + )->addColumn( + 'entity_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Entity Model' + )->addColumn( + 'attribute_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Attribute Model' + )->addColumn( + 'entity_table', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Entity Table' + )->addColumn( + 'value_table_prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value Table Prefix' + )->addColumn( + 'entity_id_field', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Entity Id Field' + )->addColumn( + 'is_data_sharing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Defines Is Data Sharing' + )->addColumn( + 'data_sharing_key', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['default' => 'default'], + 'Data Sharing Key' + )->addColumn( + 'default_attribute_set_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Default Attribute Set Id' + )->addColumn( + 'increment_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => false], + 'Increment Model' + )->addColumn( + 'increment_per_store', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Increment Per Store' + )->addColumn( + 'increment_pad_length', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '8'], + 'Increment Pad Length' + )->addColumn( + 'increment_pad_char', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 1, + ['nullable' => false, 'default' => '0'], + 'Increment Pad Char' + )->addColumn( + 'additional_attribute_table', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => false], + 'Additional Attribute Table' + )->addColumn( + 'entity_attribute_collection', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Entity Attribute Collection' + )->addIndex( + $installer->getIdxName('eav_entity_type', ['entity_type_code']), + ['entity_type_code'] + )->setComment( + 'Eav Entity Type' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + 50, + ['nullable' => true, 'default' => null], + 'Increment Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Parent Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Updated At' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Defines Is Entity Active' + )->addIndex( + $installer->getIdxName('eav_entity', ['entity_type_id']), + ['entity_type_id'] + )->addIndex( + $installer->getIdxName('eav_entity', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_datetime' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_datetime') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + ['nullable' => true, 'default' => null], + 'Attribute Value' + )->addIndex( + $installer->getIdxName('eav_entity_datetime', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('eav_entity_datetime', ['attribute_id', 'value']), + ['attribute_id', 'value'] + )->addIndex( + $installer->getIdxName('eav_entity_datetime', ['entity_type_id', 'value']), + ['entity_type_id', 'value'] + )->addIndex( + $installer->getIdxName( + 'eav_entity_datetime', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_entity_datetime', 'entity_id', 'eav_entity', 'entity_id'), + 'entity_id', + $installer->getTable('eav_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_datetime', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Value Prefix' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_decimal' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_decimal') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Attribute Value' + )->addIndex( + $installer->getIdxName('eav_entity_decimal', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('eav_entity_decimal', ['attribute_id', 'value']), + ['attribute_id', 'value'] + )->addIndex( + $installer->getIdxName('eav_entity_decimal', ['entity_type_id', 'value']), + ['entity_type_id', 'value'] + )->addIndex( + $installer->getIdxName( + 'eav_entity_decimal', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_entity_decimal', 'entity_id', 'eav_entity', 'entity_id'), + 'entity_id', + $installer->getTable('eav_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Value Prefix' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_int' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_int') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Attribute Value' + )->addIndex( + $installer->getIdxName('eav_entity_int', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('eav_entity_int', ['attribute_id', 'value']), + ['attribute_id', 'value'] + )->addIndex( + $installer->getIdxName('eav_entity_int', ['entity_type_id', 'value']), + ['entity_type_id', 'value'] + )->addIndex( + $installer->getIdxName( + 'eav_entity_int', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_entity_int', 'entity_id', 'eav_entity', 'entity_id'), + 'entity_id', + $installer->getTable('eav_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_int', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Value Prefix' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_text' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_text') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Attribute Value' + )->addIndex( + $installer->getIdxName('eav_entity_text', ['entity_type_id']), + ['entity_type_id'] + )->addIndex( + $installer->getIdxName('eav_entity_text', ['attribute_id']), + ['attribute_id'] + )->addIndex( + $installer->getIdxName('eav_entity_text', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName( + 'eav_entity_text', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_entity_text', 'entity_id', 'eav_entity', 'entity_id'), + 'entity_id', + $installer->getTable('eav_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_text', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Value Prefix' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_varchar' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_varchar') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 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, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Attribute Value' + )->addIndex( + $installer->getIdxName('eav_entity_varchar', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('eav_entity_varchar', ['attribute_id', 'value']), + ['attribute_id', 'value'] + )->addIndex( + $installer->getIdxName('eav_entity_varchar', ['entity_type_id', 'value']), + ['entity_type_id', 'value'] + )->addIndex( + $installer->getIdxName( + 'eav_entity_varchar', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_entity_varchar', 'entity_id', 'eav_entity', 'entity_id'), + 'entity_id', + $installer->getTable('eav_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_varchar', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Value Prefix' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute') + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Id' + )->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type Id' + )->addColumn( + 'attribute_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Attribute Code' + )->addColumn( + 'attribute_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Attribute Model' + )->addColumn( + 'backend_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Backend Model' + )->addColumn( + 'backend_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 8, + ['nullable' => false, 'default' => 'static'], + 'Backend Type' + )->addColumn( + 'backend_table', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Backend Table' + )->addColumn( + 'frontend_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Frontend Model' + )->addColumn( + 'frontend_input', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Frontend Input' + )->addColumn( + 'frontend_label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Frontend Label' + )->addColumn( + 'frontend_class', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Frontend Class' + )->addColumn( + 'source_model', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Source Model' + )->addColumn( + 'is_required', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Defines Is Required' + )->addColumn( + 'is_user_defined', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Defines Is User Defined' + )->addColumn( + 'default_value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Default Value' + )->addColumn( + 'is_unique', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Defines Is Unique' + )->addColumn( + 'note', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Note' + )->addIndex( + $installer->getIdxName( + 'eav_attribute', + ['entity_type_id', 'attribute_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'attribute_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_attribute', '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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_store' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_store') + )->addColumn( + 'entity_store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Store Id' + )->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'increment_prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + ['nullable' => true], + 'Increment Prefix' + )->addColumn( + 'increment_last_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => true], + 'Last Incremented Id' + )->addIndex( + $installer->getIdxName('eav_entity_store', ['entity_type_id']), + ['entity_type_id'] + )->addIndex( + $installer->getIdxName('eav_entity_store', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('eav_entity_store', '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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Store' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute_set' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute_set') + )->addColumn( + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Set 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_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Attribute Set Name' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addIndex( + $installer->getIdxName( + 'eav_attribute_set', + ['entity_type_id', 'attribute_set_name'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'attribute_set_name'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('eav_attribute_set', ['entity_type_id', 'sort_order']), + ['entity_type_id', 'sort_order'] + )->addForeignKey( + $installer->getFkName('eav_attribute_set', '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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute Set' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute_group' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute_group') + )->addColumn( + 'attribute_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Group Id' + )->addColumn( + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Set Id' + )->addColumn( + 'attribute_group_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Attribute Group Name' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addColumn( + 'default_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Default Id' + )->addColumn( + 'attribute_group_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['default' => null], + 'Attribute Group Code' + )->addColumn( + 'tab_group_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['default' => null], + 'Tab Group Code' + )->addIndex( + $installer->getIdxName( + 'eav_attribute_group', + ['attribute_set_id', 'attribute_group_name'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['attribute_set_id', 'attribute_group_name'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('eav_attribute_group', ['attribute_set_id', 'sort_order']), + ['attribute_set_id', 'sort_order'] + )->addForeignKey( + $installer->getFkName('eav_attribute_group', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), + 'attribute_set_id', + $installer->getTable('eav_attribute_set'), + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute Group' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_entity_attribute' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_entity_attribute') + )->addColumn( + 'entity_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Attribute 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( + 'attribute_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Group Id' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addIndex( + $installer->getIdxName( + 'eav_entity_attribute', + ['attribute_set_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['attribute_set_id', 'attribute_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName( + 'eav_entity_attribute', + ['attribute_group_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['attribute_group_id', 'attribute_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('eav_entity_attribute', ['attribute_set_id', 'sort_order']), + ['attribute_set_id', 'sort_order'] + )->addIndex( + $installer->getIdxName('eav_entity_attribute', ['attribute_id']), + ['attribute_id'] + )->addForeignKey( + $installer->getFkName('eav_entity_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_entity_attribute', + 'attribute_group_id', + 'eav_attribute_group', + 'attribute_group_id' + ), + 'attribute_group_id', + $installer->getTable('eav_attribute_group'), + 'attribute_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Entity Attributes' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute_option' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute_option') + )->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Id' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + )->addIndex( + $installer->getIdxName('eav_attribute_option', ['attribute_id']), + ['attribute_id'] + )->addForeignKey( + $installer->getFkName('eav_attribute_option', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute Option' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute_option_value' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute_option_value') + )->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value Id' + )->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Value' + )->addIndex( + $installer->getIdxName('eav_attribute_option_value', ['option_id']), + ['option_id'] + )->addIndex( + $installer->getIdxName('eav_attribute_option_value', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('eav_attribute_option_value', 'option_id', 'eav_attribute_option', 'option_id'), + 'option_id', + $installer->getTable('eav_attribute_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_attribute_option_value', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute Option Value' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_attribute_label' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_attribute_label') + )->addColumn( + 'attribute_label_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Label Id' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Value' + )->addIndex( + $installer->getIdxName('eav_attribute_label', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('eav_attribute_label', ['attribute_id', 'store_id']), + ['attribute_id', 'store_id'] + )->addForeignKey( + $installer->getFkName('eav_attribute_label', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_attribute_label', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Attribute Label' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_form_type' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_form_type') + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Type Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => false], + 'Code' + )->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Label' + )->addColumn( + 'is_system', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is System' + )->addColumn( + 'theme', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => true], + 'Theme' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + )->addIndex( + $installer->getIdxName( + 'eav_form_type', + ['code', 'theme', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['code', 'theme', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('eav_form_type', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('eav_form_type', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Form Type' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_form_type_entity' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_form_type_entity') + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Type Id' + )->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Type Id' + )->addIndex( + $installer->getIdxName('eav_form_type_entity', ['entity_type_id']), + ['entity_type_id'] + )->addForeignKey( + $installer->getFkName('eav_form_type_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, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_form_type_entity', 'type_id', 'eav_form_type', 'type_id'), + 'type_id', + $installer->getTable('eav_form_type'), + 'type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Form Type Entity' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_form_fieldset' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_form_fieldset') + )->addColumn( + 'fieldset_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Fieldset Id' + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Type Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => false], + 'Code' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addIndex( + $installer->getIdxName( + 'eav_form_fieldset', + ['type_id', 'code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['type_id', 'code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('eav_form_fieldset', 'type_id', 'eav_form_type', 'type_id'), + 'type_id', + $installer->getTable('eav_form_type'), + 'type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Form Fieldset' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_form_fieldset_label' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_form_fieldset_label') + )->addColumn( + 'fieldset_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Fieldset Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store Id' + )->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Label' + )->addIndex( + $installer->getIdxName('eav_form_fieldset_label', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('eav_form_fieldset_label', 'fieldset_id', 'eav_form_fieldset', 'fieldset_id'), + 'fieldset_id', + $installer->getTable('eav_form_fieldset'), + 'fieldset_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_form_fieldset_label', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Form Fieldset Label' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'eav_form_element' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('eav_form_element') + )->addColumn( + 'element_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Element Id' + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Type Id' + )->addColumn( + 'fieldset_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Fieldset Id' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Attribute Id' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Sort Order' + )->addIndex( + $installer->getIdxName( + 'eav_form_element', + ['type_id', 'attribute_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['type_id', 'attribute_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('eav_form_element', ['fieldset_id']), + ['fieldset_id'] + )->addIndex( + $installer->getIdxName('eav_form_element', ['attribute_id']), + ['attribute_id'] + )->addForeignKey( + $installer->getFkName('eav_form_element', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_form_element', 'fieldset_id', 'eav_form_fieldset', 'fieldset_id'), + 'fieldset_id', + $installer->getTable('eav_form_fieldset'), + 'fieldset_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('eav_form_element', 'type_id', 'eav_form_type', 'type_id'), + 'type_id', + $installer->getTable('eav_form_type'), + 'type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Eav Form Element' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Email/Setup/InstallSchema.php b/app/code/Magento/Email/Setup/InstallSchema.php index f79578c3fd6d2..60b315057d10e 100644 --- a/app/code/Magento/Email/Setup/InstallSchema.php +++ b/app/code/Magento/Email/Setup/InstallSchema.php @@ -1,11 +1,8 @@ getConnection()->newTable( - $installer->getTable('email_template') - )->addColumn( - 'template_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Template Id' - )->addColumn( - 'template_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 150, - ['nullable' => false], - 'Template Name' - )->addColumn( - 'template_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Template Content' - )->addColumn( - 'template_styles', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Templste Styles' - )->addColumn( - 'template_type', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Template Type' - )->addColumn( - 'template_subject', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - ['nullable' => false], - 'Template Subject' - )->addColumn( - 'template_sender_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Template Sender Name' - )->addColumn( - 'template_sender_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Template Sender Email' - )->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Date of Template Creation' - )->addColumn( - 'modified_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Date of Template Modification' - )->addColumn( - 'orig_template_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Original Template Code' - )->addColumn( - 'orig_template_variables', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Original Template Variables' - )->addIndex( - $installer->getIdxName( - 'email_template', - ['template_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['template_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('email_template', ['added_at']), - ['added_at'] - )->addIndex( - $installer->getIdxName('email_template', ['modified_at']), - ['modified_at'] - )->setComment( - 'Email Templates' - ); - - $installer->getConnection()->createTable($table); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + /** + * Create table 'email_template' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('email_template') + )->addColumn( + 'template_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Template Id' + )->addColumn( + 'template_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 150, + ['nullable' => false], + 'Template Name' + )->addColumn( + 'template_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Template Content' + )->addColumn( + 'template_styles', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Templste Styles' + )->addColumn( + 'template_type', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Template Type' + )->addColumn( + 'template_subject', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + ['nullable' => false], + 'Template Subject' + )->addColumn( + 'template_sender_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Template Sender Name' + )->addColumn( + 'template_sender_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Template Sender Email' + )->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Date of Template Creation' + )->addColumn( + 'modified_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Date of Template Modification' + )->addColumn( + 'orig_template_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Original Template Code' + )->addColumn( + 'orig_template_variables', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Original Template Variables' + )->addIndex( + $installer->getIdxName( + 'email_template', + ['template_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['template_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('email_template', ['added_at']), + ['added_at'] + )->addIndex( + $installer->getIdxName('email_template', ['modified_at']), + ['modified_at'] + )->setComment( + 'Email Templates' + ); + + $installer->getConnection()->createTable($table); + + } } \ No newline at end of file diff --git a/app/code/Magento/GiftMessage/Setup/InstallSchema.php b/app/code/Magento/GiftMessage/Setup/InstallSchema.php index c701c341602bd..e73c25fff6a47 100644 --- a/app/code/Magento/GiftMessage/Setup/InstallSchema.php +++ b/app/code/Magento/GiftMessage/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'gift_message' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('gift_message') - )->addColumn( - 'gift_message_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'GiftMessage Id' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer id' - )->addColumn( - 'sender', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sender' - )->addColumn( - 'recipient', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Recipient' - )->addColumn( - 'message', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'Message' - )->setComment( - 'Gift Message' - ); - - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $installer->startSetup(); + + /** + * Create table 'gift_message' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('gift_message') + )->addColumn( + 'gift_message_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'GiftMessage Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer id' + )->addColumn( + 'sender', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sender' + )->addColumn( + 'recipient', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Recipient' + )->addColumn( + 'message', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'Message' + )->setComment( + 'Gift Message' + ); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php index 9e93439acedad..25bec445bf7bf 100644 --- a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php +++ b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'googleoptimizer_code' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('googleoptimizer_code')) - ->addColumn( - 'code_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Google experiment code id' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Optimized entity id product id or catalog id' - ) - ->addColumn( - 'entity_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Optimized entity type' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store id' - ) - ->addColumn( - 'experiment_script', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Google experiment script' - ) - ->addIndex( - $installer->getIdxName( - 'googleoptimizer_code', - ['store_id', 'entity_id', 'entity_type'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['store_id', 'entity_id', 'entity_type'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addForeignKey( - $installer->getFkName('googleoptimizer_code', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Google Experiment code'); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'googleoptimizer_code' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('googleoptimizer_code')) + ->addColumn( + 'code_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Google experiment code id' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Optimized entity id product id or catalog id' + ) + ->addColumn( + 'entity_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Optimized entity type' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store id' + ) + ->addColumn( + 'experiment_script', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Google experiment script' + ) + ->addIndex( + $installer->getIdxName( + 'googleoptimizer_code', + ['store_id', 'entity_id', 'entity_type'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['store_id', 'entity_id', 'entity_type'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('googleoptimizer_code', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Google Experiment code'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/GoogleShopping/Setup/InstallSchema.php b/app/code/Magento/GoogleShopping/Setup/InstallSchema.php index 5e3537508a165..034391e7bf501 100644 --- a/app/code/Magento/GoogleShopping/Setup/InstallSchema.php +++ b/app/code/Magento/GoogleShopping/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - $connection = $installer->getConnection(); - - $table = $connection->newTable($setup->getTable('googleshopping_types')) - ->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Type ID' - ) - ->addColumn( - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Attribute Set Id' - ) - ->addColumn( - 'target_country', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - ['nullable' => false, 'default' => 'US'], - 'Target country' - ) - ->addColumn( - 'category', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Google product category' - ) - ->addForeignKey( - $installer->getFkName('googleshopping_types', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), - 'attribute_set_id', - $setup->getTable('eav_attribute_set'), - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $installer->getIdxName( - 'googleshopping_types', - ['attribute_set_id', 'target_country'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['attribute_set_id', 'target_country'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->setComment('Google Content Item Types link Attribute Sets'); - $installer->getConnection()->createTable($table); - - $table = $connection->newTable($setup->getTable('googleshopping_items')) - ->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'unsigned' => true, 'primary' => true], - 'Item Id' - ) - ->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true, 'default' => 0], - 'Type Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Product Id' - ) - ->addColumn( - 'gcontent_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Google Content Item Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'unsigned' => true], - 'Store Id' - ) - ->addColumn( - 'published', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Published date' - ) - ->addColumn( - 'expires', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Expires date' - ) - ->addForeignKey( - $installer->getFkName('googleshopping_items', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $setup->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('googleshopping_items', 'store_id', 'store', 'store_id'), - 'store_id', - $setup->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $installer->getIdxName('googleshopping_items', ['product_id', 'store_id']), - ['product_id', 'store_id'] - ) - ->setComment('Google Content Items Products'); - $installer->getConnection()->createTable($table); - - $table = $connection->newTable($setup->getTable('googleshopping_attributes')) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 10, - ['identity' => true, 'nullable' => false, 'unsigned' => true, 'primary' => true], - 'Id' - ) - ->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'unsigned' => true], - 'Attribute Id' - ) - ->addColumn( - 'gcontent_attribute', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Google Content Attribute' - ) - ->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Type Id' - ) - ->addForeignKey( - $installer->getFkName('googleshopping_attributes', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $setup->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('googleshopping_attributes', 'type_id', 'googleshopping_types', 'type_id'), - 'type_id', - $setup->getTable('googleshopping_types'), - 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Google Content Attributes link Product Attributes'); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + $connection = $installer->getConnection(); + + $table = $connection->newTable($setup->getTable('googleshopping_types')) + ->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Type ID' + ) + ->addColumn( + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Attribute Set Id' + ) + ->addColumn( + 'target_country', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + ['nullable' => false, 'default' => 'US'], + 'Target country' + ) + ->addColumn( + 'category', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Google product category' + ) + ->addForeignKey( + $installer->getFkName('googleshopping_types', + 'attribute_set_id', + 'eav_attribute_set', + 'attribute_set_id' + ), + 'attribute_set_id', + $setup->getTable('eav_attribute_set'), + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addIndex( + $installer->getIdxName( + 'googleshopping_types', + ['attribute_set_id', 'target_country'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['attribute_set_id', 'target_country'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->setComment('Google Content Item Types link Attribute Sets'); + $installer->getConnection()->createTable($table); + + $table = $connection->newTable($setup->getTable('googleshopping_items')) + ->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'unsigned' => true, 'primary' => true], + 'Item Id' + ) + ->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true, 'default' => 0], + 'Type Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Product Id' + ) + ->addColumn( + 'gcontent_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Google Content Item Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'unsigned' => true], + 'Store Id' + ) + ->addColumn( + 'published', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Published date' + ) + ->addColumn( + 'expires', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Expires date' + ) + ->addForeignKey( + $installer->getFkName('googleshopping_items', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $setup->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('googleshopping_items', 'store_id', 'store', 'store_id'), + 'store_id', + $setup->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addIndex( + $installer->getIdxName('googleshopping_items', ['product_id', 'store_id']), + ['product_id', 'store_id'] + ) + ->setComment('Google Content Items Products'); + $installer->getConnection()->createTable($table); + + $table = $connection->newTable($setup->getTable('googleshopping_attributes')) + ->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 10, + ['identity' => true, 'nullable' => false, 'unsigned' => true, 'primary' => true], + 'Id' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'unsigned' => true], + 'Attribute Id' + ) + ->addColumn( + 'gcontent_attribute', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Google Content Attribute' + ) + ->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Type Id' + ) + ->addForeignKey( + $installer->getFkName('googleshopping_attributes', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $setup->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('googleshopping_attributes', 'type_id', 'googleshopping_types', 'type_id'), + 'type_id', + $setup->getTable('googleshopping_types'), + 'type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Google Content Attributes link Product Attributes'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/ImportExport/Setup/InstallSchema.php b/app/code/Magento/ImportExport/Setup/InstallSchema.php index beb8086fcfb90..d2c3cc3dee8d5 100644 --- a/app/code/Magento/ImportExport/Setup/InstallSchema.php +++ b/app/code/Magento/ImportExport/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'importexport_importdata' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('importexport_importdata')) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - ) - ->addColumn( - 'entity', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false], - 'Entity' - ) - ->addColumn( - 'behavior', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 10, - ['nullable' => false, 'default' => 'append'], - 'Behavior' - ) - ->addColumn( - 'data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '4G', - ['default' => false], - 'Data' - ) - ->setComment('Import Data Table'); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $installer->startSetup(); + + /** + * Create table 'importexport_importdata' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('importexport_importdata')) + ->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + ) + ->addColumn( + 'entity', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false], + 'Entity' + ) + ->addColumn( + 'behavior', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 10, + ['nullable' => false, 'default' => 'append'], + 'Behavior' + ) + ->addColumn( + 'data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '4G', + ['default' => false], + 'Data' + ) + ->setComment('Import Data Table'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Indexer/Setup/InstallSchema.php b/app/code/Magento/Indexer/Setup/InstallSchema.php index 1472bfcd884e6..063fedf86d1b2 100644 --- a/app/code/Magento/Indexer/Setup/InstallSchema.php +++ b/app/code/Magento/Indexer/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'indexer_state' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('indexer_state')) - ->addColumn( - 'state_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Indexer State Id' - ) - ->addColumn( - 'indexer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Indexer Id' - ) - ->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['default' => 'invalid'], - 'Indexer Status' - ) - ->addColumn( - 'updated', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Indexer Status' - ) - ->addIndex( - $installer->getIdxName('indexer_state', ['indexer_id']), - ['indexer_id'] - ) - ->setComment('Indexer State'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'mview_state' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('mview_state')) - ->addColumn( - 'state_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [ - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], - 'View State Id' - ) - ->addColumn( - 'view_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'View Id' - ) - ->addColumn( - 'mode', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['default' => 'disabled'], - 'View Mode' - ) - ->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['default' => 'idle'], - 'View Status' - ) - ->addColumn( - 'updated', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'View updated time' - ) - ->addColumn( - 'version_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'View Version Id' - ) - ->addIndex( - $installer->getIdxName('mview_state', ['view_id']), - ['view_id'] - ) - ->addIndex( - $installer->getIdxName('mview_state', ['mode']), - ['mode'] - ) - ->setComment('View State'); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'indexer_state' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('indexer_state')) + ->addColumn( + 'state_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Indexer State Id' + ) + ->addColumn( + 'indexer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Indexer Id' + ) + ->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['default' => 'invalid'], + 'Indexer Status' + ) + ->addColumn( + 'updated', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Indexer Status' + ) + ->addIndex( + $installer->getIdxName('indexer_state', ['indexer_id']), + ['indexer_id'] + ) + ->setComment('Indexer State'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'mview_state' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('mview_state')) + ->addColumn( + 'state_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [ + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ], + 'View State Id' + ) + ->addColumn( + 'view_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'View Id' + ) + ->addColumn( + 'mode', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['default' => 'disabled'], + 'View Mode' + ) + ->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['default' => 'idle'], + 'View Status' + ) + ->addColumn( + 'updated', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'View updated time' + ) + ->addColumn( + 'version_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'View Version Id' + ) + ->addIndex( + $installer->getIdxName('mview_state', ['view_id']), + ['view_id'] + ) + ->addIndex( + $installer->getIdxName('mview_state', ['mode']), + ['mode'] + ) + ->setComment('View State'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Integration/Setup/InstallSchema.php b/app/code/Magento/Integration/Setup/InstallSchema.php index 90f4cc4af8706..9a58b14c465a0 100644 --- a/app/code/Magento/Integration/Setup/InstallSchema.php +++ b/app/code/Magento/Integration/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'oauth_consumer' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('oauth_consumer') - )->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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Updated At' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Name of consumer' - )->addColumn( - 'key', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Key code' - )->addColumn( - 'secret', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Secret code' - )->addColumn( - 'callback_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Callback URL' - )->addColumn( - 'rejected_callback_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Rejected callback URL' - )->addIndex( - $installer->getIdxName( - $installer->getTable('oauth_consumer'), - ['key'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['key'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName( - $installer->getTable('oauth_consumer'), - ['secret'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['secret'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('oauth_consumer', ['created_at']), - ['created_at'] - )->addIndex( - $installer->getIdxName('oauth_consumer', ['updated_at']), - ['updated_at'] - )->setComment( - 'OAuth Consumers' - ); - $installer->getConnection()->createTable($table); - - $adminTable = $installer->getTable('admin_user'); - $customerTable = $installer->getTable('customer_entity'); - - /** - * Create table 'oauth_token' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('oauth_token') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - )->addColumn( - 'consumer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true], - 'Oauth Consumer ID' - )->addColumn( - 'admin_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true], - 'Admin user ID' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true], - 'Customer user ID' - )->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['nullable' => false], - 'Token Type' - )->addColumn( - 'token', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Token' - )->addColumn( - 'secret', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Token Secret' - )->addColumn( - 'verifier', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true], - 'Token Verifier' - )->addColumn( - 'callback_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Token Callback URL' - )->addColumn( - 'revoked', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Is Token revoked' - )->addColumn( - 'authorized', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Is Token authorized' - )->addColumn( - 'user_type', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'User type' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], - 'Token creation timestamp' - )->addIndex( - $installer->getIdxName( - $installer->getTable('oauth_token'), - ['consumer_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX - ), - ['consumer_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX] - )->addIndex( - $installer->getIdxName( - $installer->getTable('oauth_token'), - ['token'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['token'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('oauth_token', 'admin_id', 'admin_user', 'user_id'), - 'admin_id', - $installer->getTable('admin_user'), - 'user_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('oauth_token', 'consumer_id', 'oauth_consumer', 'entity_id'), - 'consumer_id', - $installer->getTable('oauth_consumer'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('oauth_token', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'OAuth Tokens' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'oauth_nonce' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('oauth_nonce') - )->addColumn( - 'nonce', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Nonce String' - )->addColumn( - 'timestamp', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 10, - ['unsigned' => true, 'nullable' => false], - 'Nonce Timestamp' - )->addColumn( - 'consumer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Consumer ID' - )->addIndex( - $installer->getIdxName( - $installer->getTable('oauth_nonce'), - ['nonce', 'consumer_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['nonce', 'consumer_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('oauth_nonce', 'consumer_id', 'oauth_consumer', 'entity_id'), - 'consumer_id', - $installer->getTable('oauth_consumer'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'OAuth Nonce' - )->setOption( - 'type', - 'MyISAM' - ); - $installer->getConnection()->createTable($table); - - $table = $installer->getConnection()->newTable( - $installer->getTable('integration') - )->addColumn( - 'integration_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Integration ID' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Integration name is displayed in the admin interface' - )->addColumn( - 'email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Email address of the contact person' - )->addColumn( - 'endpoint', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Endpoint for posting consumer credentials' - )->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Integration status' - )->addColumn( - 'consumer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Oauth consumer' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Creation Time' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Update Time' - )->addColumn( - 'setup_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Integration type - manual or config file' - )->addColumn( - 'identity_link_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Identity linking Url' - )->addIndex( - $installer->getIdxName( - $installer->getTable('integration'), - ['name'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['name'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName( - $installer->getTable('integration'), - ['consumer_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['consumer_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('integration', 'consumer_id', $installer->getTable('oauth_consumer'), 'entity_id'), - 'consumer_id', - $installer->getTable('oauth_consumer'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ); - - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $installer->startSetup(); + + /** + * Create table 'oauth_consumer' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('oauth_consumer') + )->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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Updated At' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Name of consumer' + )->addColumn( + 'key', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Key code' + )->addColumn( + 'secret', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Secret code' + )->addColumn( + 'callback_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Callback URL' + )->addColumn( + 'rejected_callback_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Rejected callback URL' + )->addIndex( + $installer->getIdxName( + $installer->getTable('oauth_consumer'), + ['key'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['key'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName( + $installer->getTable('oauth_consumer'), + ['secret'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['secret'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('oauth_consumer', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('oauth_consumer', ['updated_at']), + ['updated_at'] + )->setComment( + 'OAuth Consumers' + ); + $installer->getConnection()->createTable($table); + + $adminTable = $installer->getTable('admin_user'); + $customerTable = $installer->getTable('customer_entity'); + + /** + * Create table 'oauth_token' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('oauth_token') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + )->addColumn( + 'consumer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true], + 'Oauth Consumer ID' + )->addColumn( + 'admin_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true], + 'Admin user ID' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true], + 'Customer user ID' + )->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['nullable' => false], + 'Token Type' + )->addColumn( + 'token', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Token' + )->addColumn( + 'secret', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Token Secret' + )->addColumn( + 'verifier', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true], + 'Token Verifier' + )->addColumn( + 'callback_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Token Callback URL' + )->addColumn( + 'revoked', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Is Token revoked' + )->addColumn( + 'authorized', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Is Token authorized' + )->addColumn( + 'user_type', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'User type' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], + 'Token creation timestamp' + )->addIndex( + $installer->getIdxName( + $installer->getTable('oauth_token'), + ['consumer_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX + ), + ['consumer_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX] + )->addIndex( + $installer->getIdxName( + $installer->getTable('oauth_token'), + ['token'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['token'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('oauth_token', 'admin_id', 'admin_user', 'user_id'), + 'admin_id', + $installer->getTable('admin_user'), + 'user_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('oauth_token', 'consumer_id', 'oauth_consumer', 'entity_id'), + 'consumer_id', + $installer->getTable('oauth_consumer'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('oauth_token', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'OAuth Tokens' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'oauth_nonce' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('oauth_nonce') + )->addColumn( + 'nonce', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Nonce String' + )->addColumn( + 'timestamp', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 10, + ['unsigned' => true, 'nullable' => false], + 'Nonce Timestamp' + )->addColumn( + 'consumer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Consumer ID' + )->addIndex( + $installer->getIdxName( + $installer->getTable('oauth_nonce'), + ['nonce', 'consumer_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['nonce', 'consumer_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('oauth_nonce', 'consumer_id', 'oauth_consumer', 'entity_id'), + 'consumer_id', + $installer->getTable('oauth_consumer'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'OAuth Nonce' + )->setOption( + 'type', + 'MyISAM' + ); + $installer->getConnection()->createTable($table); + + $table = $installer->getConnection()->newTable( + $installer->getTable('integration') + )->addColumn( + 'integration_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Integration ID' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Integration name is displayed in the admin interface' + )->addColumn( + 'email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Email address of the contact person' + )->addColumn( + 'endpoint', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Endpoint for posting consumer credentials' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Integration status' + )->addColumn( + 'consumer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Oauth consumer' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Creation Time' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Update Time' + )->addColumn( + 'setup_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Integration type - manual or config file' + )->addColumn( + 'identity_link_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Identity linking Url' + )->addIndex( + $installer->getIdxName( + $installer->getTable('integration'), + ['name'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['name'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName( + $installer->getTable('integration'), + ['consumer_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['consumer_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('integration', 'consumer_id', $installer->getTable('oauth_consumer'), 'entity_id'), + 'consumer_id', + $installer->getTable('oauth_consumer'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Log/Setup/InstallSchema.php b/app/code/Magento/Log/Setup/InstallSchema.php index bf86e2e058383..e9efbd9eacb15 100644 --- a/app/code/Magento/Log/Setup/InstallSchema.php +++ b/app/code/Magento/Log/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'log_customer' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('log_customer') - )->addColumn( - 'log_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Log ID' - )->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true], - 'Visitor ID' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Customer ID' - )->addColumn( - 'login_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Login Time' - )->addColumn( - 'logout_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Logout Time' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store ID' - )->addIndex( - $installer->getIdxName('log_customer', ['visitor_id']), - ['visitor_id'] - )->setComment( - 'Log Customers Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'log_quote' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('log_quote') - )->addColumn( - 'quote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Quote ID' - )->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true], - 'Visitor ID' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Creation Time' - )->addColumn( - 'deleted_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Deletion Time' - )->setComment( - 'Log Quotes Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'log_summary' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('log_summary') - )->addColumn( - 'summary_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Summary ID' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store ID' - )->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Type ID' - )->addColumn( - 'visitor_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Visitor Count' - )->addColumn( - 'customer_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Customer Count' - )->addColumn( - 'add_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Date' - )->setComment( - 'Log Summary Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'log_summary_type' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('log_summary_type') - )->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Type ID' - )->addColumn( - 'type_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => true, 'default' => null], - 'Type Code' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Period' - )->addColumn( - 'period_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 6, - ['nullable' => false, 'default' => 'MINUTE'], - 'Period Type' - )->setComment( - 'Log Summary Types Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'log_url' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('log_url') - )->addColumn( - 'url_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'URL ID' - )->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true], - 'Visitor ID' - )->addColumn( - 'visit_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Visit Time' - )->addIndex( - $installer->getIdxName('log_url', ['visitor_id']), - ['visitor_id'] - )->setComment( - 'Log URL Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'log_url_info' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('log_url_info') - )->addColumn( - 'url_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'URL ID' - )->addColumn( - 'url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'URL' - )->addColumn( - 'referer', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Referrer' - )->setComment( - 'Log URL Info Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'log_visitor' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('log_visitor') - )->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Visitor ID' - )->addColumn( - 'first_visit_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'First Visit Time' - )->addColumn( - 'last_visit_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Last Visit Time' - )->addColumn( - 'last_url_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Last URL ID' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store ID' - )->setComment( - 'Log Visitors Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'log_visitor_info' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('log_visitor_info') - )->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Visitor ID' - )->addColumn( - 'http_referer', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'HTTP Referrer' - )->addColumn( - 'http_user_agent', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'HTTP User-Agent' - )->addColumn( - 'http_accept_charset', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'HTTP Accept-Charset' - )->addColumn( - 'http_accept_language', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'HTTP Accept-Language' - )->addColumn( - 'server_addr', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - [], - 'Server Address' - )->addColumn( - 'remote_addr', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - [], - 'Remote Address' - )->setComment( - 'Log Visitor Info Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'log_visitor_online' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('log_visitor_online') - )->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Visitor ID' - )->addColumn( - 'visitor_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 1, - ['nullable' => false], - 'Visitor Type' - )->addColumn( - 'remote_addr', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['nullable' => false], - 'Remote Address' - )->addColumn( - 'first_visit_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'First Visit Time' - )->addColumn( - 'last_visit_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Last Visit Time' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer ID' - )->addColumn( - 'last_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Last URL' - )->addIndex( - $installer->getIdxName('log_visitor_online', ['visitor_type']), - ['visitor_type'] - )->addIndex( - $installer->getIdxName('log_visitor_online', ['first_visit_at', 'last_visit_at']), - ['first_visit_at', 'last_visit_at'] - )->addIndex( - $installer->getIdxName('log_visitor_online', ['customer_id']), - ['customer_id'] - )->setComment( - 'Log Visitor Online Table' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'log_customer' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_customer') + )->addColumn( + 'log_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Log ID' + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true], + 'Visitor ID' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Customer ID' + )->addColumn( + 'login_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Login Time' + )->addColumn( + 'logout_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Logout Time' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store ID' + )->addIndex( + $installer->getIdxName('log_customer', ['visitor_id']), + ['visitor_id'] + )->setComment( + 'Log Customers Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_quote' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_quote') + )->addColumn( + 'quote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Quote ID' + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true], + 'Visitor ID' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Creation Time' + )->addColumn( + 'deleted_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Deletion Time' + )->setComment( + 'Log Quotes Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_summary' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_summary') + )->addColumn( + 'summary_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Summary ID' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store ID' + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Type ID' + )->addColumn( + 'visitor_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Visitor Count' + )->addColumn( + 'customer_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Customer Count' + )->addColumn( + 'add_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Date' + )->setComment( + 'Log Summary Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_summary_type' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_summary_type') + )->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Type ID' + )->addColumn( + 'type_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => true, 'default' => null], + 'Type Code' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Period' + )->addColumn( + 'period_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 6, + ['nullable' => false, 'default' => 'MINUTE'], + 'Period Type' + )->setComment( + 'Log Summary Types Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_url' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_url') + )->addColumn( + 'url_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'URL ID' + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true], + 'Visitor ID' + )->addColumn( + 'visit_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Visit Time' + )->addIndex( + $installer->getIdxName('log_url', ['visitor_id']), + ['visitor_id'] + )->setComment( + 'Log URL Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_url_info' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_url_info') + )->addColumn( + 'url_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'URL ID' + )->addColumn( + 'url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'URL' + )->addColumn( + 'referer', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Referrer' + )->setComment( + 'Log URL Info Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_visitor' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_visitor') + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Visitor ID' + )->addColumn( + 'first_visit_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'First Visit Time' + )->addColumn( + 'last_visit_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Last Visit Time' + )->addColumn( + 'last_url_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Last URL ID' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store ID' + )->setComment( + 'Log Visitors Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_visitor_info' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_visitor_info') + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Visitor ID' + )->addColumn( + 'http_referer', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'HTTP Referrer' + )->addColumn( + 'http_user_agent', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'HTTP User-Agent' + )->addColumn( + 'http_accept_charset', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'HTTP Accept-Charset' + )->addColumn( + 'http_accept_language', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'HTTP Accept-Language' + )->addColumn( + 'server_addr', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + [], + 'Server Address' + )->addColumn( + 'remote_addr', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + [], + 'Remote Address' + )->setComment( + 'Log Visitor Info Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'log_visitor_online' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('log_visitor_online') + )->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Visitor ID' + )->addColumn( + 'visitor_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 1, + ['nullable' => false], + 'Visitor Type' + )->addColumn( + 'remote_addr', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['nullable' => false], + 'Remote Address' + )->addColumn( + 'first_visit_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'First Visit Time' + )->addColumn( + 'last_visit_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Last Visit Time' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer ID' + )->addColumn( + 'last_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Last URL' + )->addIndex( + $installer->getIdxName('log_visitor_online', ['visitor_type']), + ['visitor_type'] + )->addIndex( + $installer->getIdxName('log_visitor_online', ['first_visit_at', 'last_visit_at']), + ['first_visit_at', 'last_visit_at'] + )->addIndex( + $installer->getIdxName('log_visitor_online', ['customer_id']), + ['customer_id'] + )->setComment( + 'Log Visitor Online Table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Newsletter/Setup/InstallSchema.php b/app/code/Magento/Newsletter/Setup/InstallSchema.php index e50e0f5eadc12..e0f8d102552b2 100644 --- a/app/code/Magento/Newsletter/Setup/InstallSchema.php +++ b/app/code/Magento/Newsletter/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'newsletter_subscriber' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_subscriber')) - ->addColumn( - 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Subscriber Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Store Id' - ) - ->addColumn( - 'change_status_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Change Status At' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Id' - ) - ->addColumn( - 'subscriber_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 150, - ['nullable' => true, 'default' => null], - 'Subscriber Email' - ) - ->addColumn( - 'subscriber_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Subscriber Status' - ) - ->addColumn( - 'subscriber_confirm_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['default' => 'NULL'], - 'Subscriber Confirm Code' - ) - ->addIndex( - $installer->getIdxName('newsletter_subscriber', ['customer_id']), - ['customer_id'] - ) - ->addIndex( - $installer->getIdxName('newsletter_subscriber', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('newsletter_subscriber', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Newsletter Subscriber'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'newsletter_template' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_template')) - ->addColumn( - 'template_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Template Id' - ) - ->addColumn( - 'template_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 150, - [], - 'Template Code' - ) - ->addColumn( - 'template_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Template Text' - ) - ->addColumn( - 'template_text_preprocessed', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Template Text Preprocessed' - ) - ->addColumn( - 'template_styles', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Template Styles' - ) - ->addColumn( - 'template_type', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Template Type' - ) - ->addColumn( - 'template_subject', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Template Subject' - ) - ->addColumn( - 'template_sender_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Template Sender Name' - ) - ->addColumn( - 'template_sender_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Template Sender Email' - ) - ->addColumn( - 'template_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '1'], - 'Template Actual' - ) - ->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Added At' - ) - ->addColumn( - 'modified_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Modified At' - ) - ->addIndex( - $installer->getIdxName('newsletter_template', ['template_actual']), - ['template_actual'] - ) - ->addIndex( - $installer->getIdxName('newsletter_template', ['added_at']), - ['added_at'] - ) - ->addIndex( - $installer->getIdxName('newsletter_template', ['modified_at']), - ['modified_at'] - ) - ->setComment('Newsletter Template'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'newsletter_queue' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_queue')) - ->addColumn( - 'queue_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Queue Id' - ) - ->addColumn( - 'template_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Template Id' - ) - ->addColumn( - 'newsletter_type', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Newsletter Type' - ) - ->addColumn( - 'newsletter_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Newsletter Text' - ) - ->addColumn( - 'newsletter_styles', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Newsletter Styles' - ) - ->addColumn( - 'newsletter_subject', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Newsletter Subject' - ) - ->addColumn( - 'newsletter_sender_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Newsletter Sender Name' - ) - ->addColumn( - 'newsletter_sender_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Newsletter Sender Email' - ) - ->addColumn( - 'queue_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Queue Status' - ) - ->addColumn( - 'queue_start_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Queue Start At' - ) - ->addColumn( - 'queue_finish_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Queue Finish At' - ) - ->addIndex( - $installer->getIdxName('newsletter_queue', ['template_id']), - ['template_id'] - ) - ->addForeignKey( - $installer->getFkName('newsletter_queue', 'template_id', 'newsletter_template', 'template_id'), - 'template_id', - $installer->getTable('newsletter_template'), - 'template_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Newsletter Queue'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'newsletter_queue_link' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_queue_link')) - ->addColumn( - 'queue_link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Queue Link Id' - ) - ->addColumn( - 'queue_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Queue Id' - ) - ->addColumn( - 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Subscriber Id' - ) - ->addColumn( - 'letter_sent_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Letter Sent At' - ) - ->addIndex( - $installer->getIdxName('newsletter_queue_link', ['subscriber_id']), - ['subscriber_id'] - ) - ->addIndex( - $installer->getIdxName('newsletter_queue_link', ['queue_id', 'letter_sent_at']), - ['queue_id', 'letter_sent_at'] - ) - ->addForeignKey( - $installer->getFkName('newsletter_queue_link', 'queue_id', 'newsletter_queue', 'queue_id'), - 'queue_id', - $installer->getTable('newsletter_queue'), - 'queue_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('newsletter_queue_link', 'subscriber_id', 'newsletter_subscriber', 'subscriber_id'), - 'subscriber_id', - $installer->getTable('newsletter_subscriber'), - 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Newsletter Queue Link'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'newsletter_queue_store_link' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_queue_store_link')) - ->addColumn( - 'queue_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Queue Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], - 'Store Id' - ) - ->addIndex( - $installer->getIdxName('newsletter_queue_store_link', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('newsletter_queue_store_link', 'queue_id', 'newsletter_queue', 'queue_id'), - 'queue_id', - $installer->getTable('newsletter_queue'), - 'queue_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('newsletter_queue_store_link', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Newsletter Queue Store Link'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'newsletter_problem' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('newsletter_problem')) - ->addColumn( - 'problem_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Problem Id' - ) - ->addColumn( - 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Subscriber Id' - ) - ->addColumn( - 'queue_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Queue Id' - ) - ->addColumn( - 'problem_error_code', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Problem Error Code' - ) - ->addColumn( - 'problem_error_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - [], - 'Problem Error Text' - ) - ->addIndex( - $installer->getIdxName('newsletter_problem', ['subscriber_id']), - ['subscriber_id'] - ) - ->addIndex( - $installer->getIdxName('newsletter_problem', ['queue_id']), - ['queue_id'] - ) - ->addForeignKey( - $installer->getFkName('newsletter_problem', 'queue_id', 'newsletter_queue', 'queue_id'), - 'queue_id', - $installer->getTable('newsletter_queue'), - 'queue_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('newsletter_problem', 'subscriber_id', 'newsletter_subscriber', 'subscriber_id'), - 'subscriber_id', - $installer->getTable('newsletter_subscriber'), - 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Newsletter Problems'); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'newsletter_subscriber' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_subscriber')) + ->addColumn( + 'subscriber_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Subscriber Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Store Id' + ) + ->addColumn( + 'change_status_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Change Status At' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Id' + ) + ->addColumn( + 'subscriber_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 150, + ['nullable' => true, 'default' => null], + 'Subscriber Email' + ) + ->addColumn( + 'subscriber_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Subscriber Status' + ) + ->addColumn( + 'subscriber_confirm_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['default' => 'NULL'], + 'Subscriber Confirm Code' + ) + ->addIndex( + $installer->getIdxName('newsletter_subscriber', ['customer_id']), + ['customer_id'] + ) + ->addIndex( + $installer->getIdxName('newsletter_subscriber', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('newsletter_subscriber', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Newsletter Subscriber'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'newsletter_template' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_template')) + ->addColumn( + 'template_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Template Id' + ) + ->addColumn( + 'template_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 150, + [], + 'Template Code' + ) + ->addColumn( + 'template_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Template Text' + ) + ->addColumn( + 'template_text_preprocessed', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Template Text Preprocessed' + ) + ->addColumn( + 'template_styles', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Template Styles' + ) + ->addColumn( + 'template_type', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Template Type' + ) + ->addColumn( + 'template_subject', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Template Subject' + ) + ->addColumn( + 'template_sender_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Template Sender Name' + ) + ->addColumn( + 'template_sender_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Template Sender Email' + ) + ->addColumn( + 'template_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '1'], + 'Template Actual' + ) + ->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Added At' + ) + ->addColumn( + 'modified_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Modified At' + ) + ->addIndex( + $installer->getIdxName('newsletter_template', ['template_actual']), + ['template_actual'] + ) + ->addIndex( + $installer->getIdxName('newsletter_template', ['added_at']), + ['added_at'] + ) + ->addIndex( + $installer->getIdxName('newsletter_template', ['modified_at']), + ['modified_at'] + ) + ->setComment('Newsletter Template'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'newsletter_queue' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_queue')) + ->addColumn( + 'queue_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Queue Id' + ) + ->addColumn( + 'template_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Template Id' + ) + ->addColumn( + 'newsletter_type', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Newsletter Type' + ) + ->addColumn( + 'newsletter_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Newsletter Text' + ) + ->addColumn( + 'newsletter_styles', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Newsletter Styles' + ) + ->addColumn( + 'newsletter_subject', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Newsletter Subject' + ) + ->addColumn( + 'newsletter_sender_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Newsletter Sender Name' + ) + ->addColumn( + 'newsletter_sender_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Newsletter Sender Email' + ) + ->addColumn( + 'queue_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Queue Status' + ) + ->addColumn( + 'queue_start_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Queue Start At' + ) + ->addColumn( + 'queue_finish_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Queue Finish At' + ) + ->addIndex( + $installer->getIdxName('newsletter_queue', ['template_id']), + ['template_id'] + ) + ->addForeignKey( + $installer->getFkName('newsletter_queue', 'template_id', 'newsletter_template', 'template_id'), + 'template_id', + $installer->getTable('newsletter_template'), + 'template_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Newsletter Queue'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'newsletter_queue_link' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_queue_link')) + ->addColumn( + 'queue_link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Queue Link Id' + ) + ->addColumn( + 'queue_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Queue Id' + ) + ->addColumn( + 'subscriber_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Subscriber Id' + ) + ->addColumn( + 'letter_sent_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Letter Sent At' + ) + ->addIndex( + $installer->getIdxName('newsletter_queue_link', ['subscriber_id']), + ['subscriber_id'] + ) + ->addIndex( + $installer->getIdxName('newsletter_queue_link', ['queue_id', 'letter_sent_at']), + ['queue_id', 'letter_sent_at'] + ) + ->addForeignKey( + $installer->getFkName('newsletter_queue_link', 'queue_id', 'newsletter_queue', 'queue_id'), + 'queue_id', + $installer->getTable('newsletter_queue'), + 'queue_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('newsletter_queue_link', + 'subscriber_id', + 'newsletter_subscriber', + 'subscriber_id' + ), + 'subscriber_id', + $installer->getTable('newsletter_subscriber'), + 'subscriber_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Newsletter Queue Link'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'newsletter_queue_store_link' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_queue_store_link')) + ->addColumn( + 'queue_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Queue Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Store Id' + ) + ->addIndex( + $installer->getIdxName('newsletter_queue_store_link', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('newsletter_queue_store_link', 'queue_id', 'newsletter_queue', 'queue_id'), + 'queue_id', + $installer->getTable('newsletter_queue'), + 'queue_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('newsletter_queue_store_link', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Newsletter Queue Store Link'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'newsletter_problem' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('newsletter_problem')) + ->addColumn( + 'problem_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Problem Id' + ) + ->addColumn( + 'subscriber_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Subscriber Id' + ) + ->addColumn( + 'queue_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Queue Id' + ) + ->addColumn( + 'problem_error_code', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Problem Error Code' + ) + ->addColumn( + 'problem_error_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + [], + 'Problem Error Text' + ) + ->addIndex( + $installer->getIdxName('newsletter_problem', ['subscriber_id']), + ['subscriber_id'] + ) + ->addIndex( + $installer->getIdxName('newsletter_problem', ['queue_id']), + ['queue_id'] + ) + ->addForeignKey( + $installer->getFkName('newsletter_problem', 'queue_id', 'newsletter_queue', 'queue_id'), + 'queue_id', + $installer->getTable('newsletter_queue'), + 'queue_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('newsletter_problem', 'subscriber_id', 'newsletter_subscriber', 'subscriber_id'), + 'subscriber_id', + $installer->getTable('newsletter_subscriber'), + 'subscriber_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Newsletter Problems'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/OfflineShipping/Setup/InstallSchema.php b/app/code/Magento/OfflineShipping/Setup/InstallSchema.php index df359b2f1db38..595a98615cdd6 100644 --- a/app/code/Magento/OfflineShipping/Setup/InstallSchema.php +++ b/app/code/Magento/OfflineShipping/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'shipping_tablerate' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('shipping_tablerate') - )->addColumn( - 'pk', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Primary key' - )->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Website Id' - )->addColumn( - 'dest_country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 4, - ['nullable' => false, 'default' => '0'], - 'Destination coutry ISO/2 or ISO/3 code' - )->addColumn( - 'dest_region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Destination Region Id' - )->addColumn( - 'dest_zip', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 10, - ['nullable' => false, 'default' => '*'], - 'Destination Post Code (Zip)' - )->addColumn( - 'condition_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - ['nullable' => false], - 'Rate Condition name' - )->addColumn( - 'condition_value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Rate condition value' - )->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' - )->addColumn( - 'cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Cost' - )->addIndex( - $installer->getIdxName( - 'shipping_tablerate', - ['website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->setComment( - 'Shipping Tablerate' - ); - $installer->getConnection()->createTable($table); - - $installer->getConnection()->addColumn( - $installer->getTable('salesrule'), - 'simple_free_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Simple Free Shipping' - ); - $installer->getConnection()->addColumn( - $installer->getTable('sales_order_item'), - 'free_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Free Shipping' - ); - $installer->getConnection()->addColumn( - $installer->getTable('quote_address'), - 'free_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Free Shipping' - ); - $installer->getConnection()->addColumn( - $installer->getTable('quote_item'), - 'free_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Free Shipping' - ); - $installer->getConnection()->addColumn( - $installer->getTable('quote_address_item'), - 'free_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Free Shipping' - ); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'shipping_tablerate' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('shipping_tablerate') + )->addColumn( + 'pk', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Primary key' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Website Id' + )->addColumn( + 'dest_country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 4, + ['nullable' => false, 'default' => '0'], + 'Destination coutry ISO/2 or ISO/3 code' + )->addColumn( + 'dest_region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Destination Region Id' + )->addColumn( + 'dest_zip', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 10, + ['nullable' => false, 'default' => '*'], + 'Destination Post Code (Zip)' + )->addColumn( + 'condition_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + ['nullable' => false], + 'Rate Condition name' + )->addColumn( + 'condition_value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Rate condition value' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + )->addColumn( + 'cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Cost' + )->addIndex( + $installer->getIdxName( + 'shipping_tablerate', + ['website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->setComment( + 'Shipping Tablerate' + ); + $installer->getConnection()->createTable($table); + + $installer->getConnection()->addColumn( + $installer->getTable('salesrule'), + 'simple_free_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Simple Free Shipping' + ); + $installer->getConnection()->addColumn( + $installer->getTable('sales_order_item'), + 'free_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Free Shipping' + ); + $installer->getConnection()->addColumn( + $installer->getTable('quote_address'), + 'free_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Free Shipping' + ); + $installer->getConnection()->addColumn( + $installer->getTable('quote_item'), + 'free_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Free Shipping' + ); + $installer->getConnection()->addColumn( + $installer->getTable('quote_address_item'), + 'free_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Free Shipping' + ); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Persistent/Setup/InstallSchema.php b/app/code/Magento/Persistent/Setup/InstallSchema.php index 6b4d1dbc2c7e2..e7bf541619798 100644 --- a/app/code/Magento/Persistent/Setup/InstallSchema.php +++ b/app/code/Magento/Persistent/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'persistent_session' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('persistent_session') - )->addColumn( - 'persistent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'primary' => true, 'nullable' => false, 'unsigned' => true], - 'Session id' - )->addColumn( - 'key', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false], - 'Unique cookie key' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer id' - )->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website ID' - )->addColumn( - 'info', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Session Data' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' - )->addIndex( - $installer->getIdxName('persistent_session', ['key']), - ['key'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('persistent_session', ['customer_id']), - ['customer_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('persistent_session', ['updated_at']), - ['updated_at'] - )->addForeignKey( - $installer->getFkName('persistent_session', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('persistent_session', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Persistent Session' - ); - - $installer->getConnection()->createTable($table); - - /** - * Alter quote table with is_persistent flag - * - */ - $installer->getConnection()->addColumn( - $installer->getTable('quote'), - 'is_persistent', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 'unsigned' => true, - 'default' => '0', - 'comment' => 'Is Quote Persistent' - ] - ); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $installer->startSetup(); + + /** + * Create table 'persistent_session' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('persistent_session') + )->addColumn( + 'persistent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'primary' => true, 'nullable' => false, 'unsigned' => true], + 'Session id' + )->addColumn( + 'key', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false], + 'Unique cookie key' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer id' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website ID' + )->addColumn( + 'info', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Session Data' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addIndex( + $installer->getIdxName('persistent_session', ['key']), + ['key'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('persistent_session', ['customer_id']), + ['customer_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('persistent_session', ['updated_at']), + ['updated_at'] + )->addForeignKey( + $installer->getFkName('persistent_session', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('persistent_session', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Persistent Session' + ); + + $installer->getConnection()->createTable($table); + + /** + * Alter quote table with is_persistent flag + * + */ + $installer->getConnection()->addColumn( + $installer->getTable('quote'), + 'is_persistent', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 'unsigned' => true, + 'default' => '0', + 'comment' => 'Is Quote Persistent' + ] + ); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/ProductAlert/Setup/InstallSchema.php b/app/code/Magento/ProductAlert/Setup/InstallSchema.php index 9a89b99451f4e..6fd68b04c8f38 100644 --- a/app/code/Magento/ProductAlert/Setup/InstallSchema.php +++ b/app/code/Magento/ProductAlert/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - /** - * Create table 'product_alert_price' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('product_alert_price') - )->addColumn( - 'alert_price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product alert price id' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer id' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product id' - )->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price amount' - )->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website id' - )->addColumn( - 'add_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Product alert add date' - )->addColumn( - 'last_send_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Product alert last send date' - )->addColumn( - 'send_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product alert send count' - )->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product alert status' - )->addIndex( - $installer->getIdxName('product_alert_price', ['customer_id']), - ['customer_id'] - )->addIndex( - $installer->getIdxName('product_alert_price', ['product_id']), - ['product_id'] - )->addIndex( - $installer->getIdxName('product_alert_price', ['website_id']), - ['website_id'] - )->addForeignKey( - $installer->getFkName('product_alert_price', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('product_alert_price', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('product_alert_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Product Alert Price' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'product_alert_stock' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('product_alert_stock') - )->addColumn( - 'alert_stock_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Product alert stock id' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer id' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product id' - )->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website id' - )->addColumn( - 'add_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Product alert add date' - )->addColumn( - 'send_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Product alert send date' - )->addColumn( - 'send_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Send Count' - )->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product alert status' - )->addIndex( - $installer->getIdxName('product_alert_stock', ['customer_id']), - ['customer_id'] - )->addIndex( - $installer->getIdxName('product_alert_stock', ['product_id']), - ['product_id'] - )->addIndex( - $installer->getIdxName('product_alert_stock', ['website_id']), - ['website_id'] - )->addForeignKey( - $installer->getFkName('product_alert_stock', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('product_alert_stock', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('product_alert_stock', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Product Alert Stock' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + /** + * Create table 'product_alert_price' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('product_alert_price') + )->addColumn( + 'alert_price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product alert price id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product id' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price amount' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website id' + )->addColumn( + 'add_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Product alert add date' + )->addColumn( + 'last_send_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Product alert last send date' + )->addColumn( + 'send_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product alert send count' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product alert status' + )->addIndex( + $installer->getIdxName('product_alert_price', ['customer_id']), + ['customer_id'] + )->addIndex( + $installer->getIdxName('product_alert_price', ['product_id']), + ['product_id'] + )->addIndex( + $installer->getIdxName('product_alert_price', ['website_id']), + ['website_id'] + )->addForeignKey( + $installer->getFkName('product_alert_price', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('product_alert_price', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('product_alert_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Product Alert Price' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'product_alert_stock' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('product_alert_stock') + )->addColumn( + 'alert_stock_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product alert stock id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product id' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website id' + )->addColumn( + 'add_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Product alert add date' + )->addColumn( + 'send_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Product alert send date' + )->addColumn( + 'send_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Send Count' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product alert status' + )->addIndex( + $installer->getIdxName('product_alert_stock', ['customer_id']), + ['customer_id'] + )->addIndex( + $installer->getIdxName('product_alert_stock', ['product_id']), + ['product_id'] + )->addIndex( + $installer->getIdxName('product_alert_stock', ['website_id']), + ['website_id'] + )->addForeignKey( + $installer->getFkName('product_alert_stock', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('product_alert_stock', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('product_alert_stock', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Product Alert Stock' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Quote/Setup/InstallSchema.php b/app/code/Magento/Quote/Setup/InstallSchema.php index dfc8e21e8b07a..4c16eede4f252 100644 --- a/app/code/Magento/Quote/Setup/InstallSchema.php +++ b/app/code/Magento/Quote/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'quote' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('quote') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store 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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' - )->addColumn( - 'converted_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Converted At' - )->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '1'], - 'Is Active' - )->addColumn( - 'is_virtual', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Is Virtual' - )->addColumn( - 'is_multi_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Is Multi Shipping' - )->addColumn( - 'items_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Items Count' - )->addColumn( - 'items_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Items Qty' - )->addColumn( - 'orig_order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Orig Order Id' - )->addColumn( - 'store_to_base_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Store To Base Rate' - )->addColumn( - 'store_to_quote_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Store To Quote Rate' - )->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Base Currency Code' - )->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Store Currency Code' - )->addColumn( - 'quote_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Quote Currency Code' - )->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Grand Total' - )->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Grand Total' - )->addColumn( - 'checkout_method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Checkout Method' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Customer Id' - )->addColumn( - 'customer_tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Customer Tax Class Id' - )->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => '0'], - 'Customer Group Id' - )->addColumn( - 'customer_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Email' - )->addColumn( - 'customer_prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Customer Prefix' - )->addColumn( - 'customer_firstname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Firstname' - )->addColumn( - 'customer_middlename', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Customer Middlename' - )->addColumn( - 'customer_lastname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Lastname' - )->addColumn( - 'customer_suffix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Customer Suffix' - )->addColumn( - 'customer_dob', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Customer Dob' - )->addColumn( - 'customer_note', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Note' - )->addColumn( - 'customer_note_notify', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '1'], - 'Customer Note Notify' - )->addColumn( - 'customer_is_guest', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Customer Is Guest' - )->addColumn( - 'remote_ip', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Remote Ip' - )->addColumn( - 'applied_rule_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Applied Rule Ids' - )->addColumn( - 'reserved_order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => true], - 'Reserved Order Id' - )->addColumn( - 'password_hash', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Password Hash' - )->addColumn( - 'coupon_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Coupon Code' - )->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Global Currency Code' - )->addColumn( - 'base_to_global_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Global Rate' - )->addColumn( - 'base_to_quote_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Quote Rate' - )->addColumn( - 'customer_taxvat', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Taxvat' - )->addColumn( - 'customer_gender', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Gender' - )->addColumn( - 'subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal' - )->addColumn( - 'base_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal' - )->addColumn( - 'subtotal_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal With Discount' - )->addColumn( - 'base_subtotal_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal With Discount' - )->addColumn( - 'is_changed', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Is Changed' - )->addColumn( - 'trigger_recollect', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Trigger Recollect' - )->addColumn( - 'ext_shipping_info', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Ext Shipping Info' - )->addIndex( - $installer->getIdxName('quote', ['customer_id', 'store_id', 'is_active']), - ['customer_id', 'store_id', 'is_active'] - )->addIndex( - $installer->getIdxName('quote', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('quote', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Quote' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'quote_address' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('quote_address') - )->addColumn( - 'address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Address Id' - )->addColumn( - 'quote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Quote 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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer Id' - )->addColumn( - 'save_in_address_book', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['default' => '0'], - 'Save In Address Book' - )->addColumn( - 'customer_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer Address Id' - )->addColumn( - 'address_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Address Type' - )->addColumn( - 'email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Email' - )->addColumn( - 'prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Prefix' - )->addColumn( - 'firstname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Firstname' - )->addColumn( - 'middlename', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Middlename' - )->addColumn( - 'lastname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Lastname' - )->addColumn( - 'suffix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Suffix' - )->addColumn( - 'company', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Company' - )->addColumn( - 'street', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Street' - )->addColumn( - 'city', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'City' - )->addColumn( - 'region', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Region' - )->addColumn( - 'region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Region Id' - )->addColumn( - 'postcode', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Postcode' - )->addColumn( - 'country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Country Id' - )->addColumn( - 'telephone', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Phone Number' - )->addColumn( - 'fax', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Fax' - )->addColumn( - 'same_as_billing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Same As Billing' - )->addColumn( - 'collect_shipping_rates', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Collect Shipping Rates' - )->addColumn( - 'shipping_method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Method' - )->addColumn( - 'shipping_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Description' - )->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Weight' - )->addColumn( - 'subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Subtotal' - )->addColumn( - 'base_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Subtotal' - )->addColumn( - 'subtotal_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Subtotal With Discount' - )->addColumn( - 'base_subtotal_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Subtotal With Discount' - )->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Tax Amount' - )->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Tax Amount' - )->addColumn( - 'shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Shipping Amount' - )->addColumn( - 'base_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Shipping Amount' - )->addColumn( - 'shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Tax Amount' - )->addColumn( - 'base_shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Tax Amount' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount' - )->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Discount Amount' - )->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Grand Total' - )->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Grand Total' - )->addColumn( - 'customer_notes', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Customer Notes' - )->addColumn( - 'applied_taxes', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Applied Taxes' - )->addColumn( - 'discount_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Discount Description' - )->addColumn( - 'shipping_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Discount Amount' - )->addColumn( - 'base_shipping_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Discount Amount' - )->addColumn( - 'subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Incl Tax' - )->addColumn( - 'base_subtotal_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Total Incl Tax' - )->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' - )->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' - )->addColumn( - 'shipping_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Hidden Tax Amount' - )->addColumn( - 'base_shipping_hidden_tax_amnt', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Hidden Tax Amount' - )->addColumn( - 'shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Incl Tax' - )->addColumn( - 'base_shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Incl Tax' - )->addIndex( - $installer->getIdxName('quote_address', ['quote_id']), - ['quote_id'] - )->addForeignKey( - $installer->getFkName('quote_address', 'quote_id', 'quote', 'entity_id'), - 'quote_id', - $installer->getTable('quote'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Quote Address' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'quote_item' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('quote_item') - )->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Item Id' - )->addColumn( - 'quote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Quote Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'parent_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Item Id' - )->addColumn( - 'is_virtual', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Virtual' - )->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' - )->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - )->addColumn( - 'applied_rule_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Applied Rule Ids' - )->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' - )->addColumn( - 'is_qty_decimal', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Qty Decimal' - )->addColumn( - 'no_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'No Discount' - )->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Weight' - )->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty' - )->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' - )->addColumn( - 'base_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Price' - )->addColumn( - 'custom_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Custom Price' - )->addColumn( - 'discount_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Percent' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Amount' - )->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Discount Amount' - )->addColumn( - 'tax_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Percent' - )->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Amount' - )->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Tax Amount' - )->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Row Total' - )->addColumn( - 'base_row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Row Total' - )->addColumn( - 'row_total_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Row Total With Discount' - )->addColumn( - 'row_weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Row Weight' - )->addColumn( - 'product_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Product Type' - )->addColumn( - 'base_tax_before_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Before Discount' - )->addColumn( - 'tax_before_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Before Discount' - )->addColumn( - 'original_custom_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Original Custom Price' - )->addColumn( - 'redirect_url', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Redirect Url' - )->addColumn( - 'base_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Cost' - )->addColumn( - 'price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price Incl Tax' - )->addColumn( - 'base_price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price Incl Tax' - )->addColumn( - 'row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total Incl Tax' - )->addColumn( - 'base_row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total Incl Tax' - )->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' - )->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' - )->addIndex( - $installer->getIdxName('quote_item', ['parent_item_id']), - ['parent_item_id'] - )->addIndex( - $installer->getIdxName('quote_item', ['product_id']), - ['product_id'] - )->addIndex( - $installer->getIdxName('quote_item', ['quote_id']), - ['quote_id'] - )->addIndex( - $installer->getIdxName('quote_item', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('quote_item', 'parent_item_id', 'quote_item', 'item_id'), - 'parent_item_id', - $installer->getTable('quote_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('quote_item', 'quote_id', 'quote', 'entity_id'), - 'quote_id', - $installer->getTable('quote'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('quote_item', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Quote Item' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'quote_address_item' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('quote_address_item') - )->addColumn( - 'address_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Address Item Id' - )->addColumn( - 'parent_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Item Id' - )->addColumn( - 'quote_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Quote Address Id' - )->addColumn( - 'quote_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Quote Item 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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' - )->addColumn( - 'applied_rule_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Applied Rule Ids' - )->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' - )->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Weight' - )->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Amount' - )->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Amount' - )->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Row Total' - )->addColumn( - 'base_row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Row Total' - )->addColumn( - 'row_total_with_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Row Total With Discount' - )->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Discount Amount' - )->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Tax Amount' - )->addColumn( - 'row_weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Row Weight' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - )->addColumn( - 'super_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Super Product Id' - )->addColumn( - 'parent_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Product Id' - )->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' - )->addColumn( - 'image', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Image' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' - )->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - )->addColumn( - 'is_qty_decimal', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Is Qty Decimal' - )->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - )->addColumn( - 'discount_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Percent' - )->addColumn( - 'no_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'No Discount' - )->addColumn( - 'tax_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Percent' - )->addColumn( - 'base_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price' - )->addColumn( - 'base_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Cost' - )->addColumn( - 'price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price Incl Tax' - )->addColumn( - 'base_price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price Incl Tax' - )->addColumn( - 'row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total Incl Tax' - )->addColumn( - 'base_row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total Incl Tax' - )->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' - )->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' - )->addIndex( - $installer->getIdxName('quote_address_item', ['quote_address_id']), - ['quote_address_id'] - )->addIndex( - $installer->getIdxName('quote_address_item', ['parent_item_id']), - ['parent_item_id'] - )->addIndex( - $installer->getIdxName('quote_address_item', ['quote_item_id']), - ['quote_item_id'] - )->addForeignKey( - $installer->getFkName( - 'quote_address_item', - 'quote_address_id', - 'quote_address', - 'address_id' - ), - 'quote_address_id', - $installer->getTable('quote_address'), - 'address_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName( - 'quote_address_item', - 'parent_item_id', - 'quote_address_item', - 'address_item_id' - ), - 'parent_item_id', - $installer->getTable('quote_address_item'), - 'address_item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('quote_address_item', 'quote_item_id', 'quote_item', 'item_id'), - 'quote_item_id', - $installer->getTable('quote_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Quote Address Item' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'quote_item_option' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('quote_item_option') - )->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Id' - )->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Item Id' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Product Id' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Code' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Value' - )->addIndex( - $installer->getIdxName('quote_item_option', ['item_id']), - ['item_id'] - )->addForeignKey( - $installer->getFkName('quote_item_option', 'item_id', 'quote_item', 'item_id'), - 'item_id', - $installer->getTable('quote_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Quote Item Option' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'quote_payment' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('quote_payment') - )->addColumn( - 'payment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Payment Id' - )->addColumn( - 'quote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Quote 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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' - )->addColumn( - 'method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Method' - )->addColumn( - 'cc_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Type' - )->addColumn( - 'cc_number_enc', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Number Enc' - )->addColumn( - 'cc_last_4', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Last 4' - )->addColumn( - 'cc_cid_enc', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Cid Enc' - )->addColumn( - 'cc_owner', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Owner' - )->addColumn( - 'cc_exp_month', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['unsigned' => true, 'default' => null, 'nullable' => true], - 'Cc Exp Month' - )->addColumn( - 'cc_exp_year', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Cc Exp Year' - )->addColumn( - 'cc_ss_owner', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Ss Owner' - )->addColumn( - 'cc_ss_start_month', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Cc Ss Start Month' - )->addColumn( - 'cc_ss_start_year', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Cc Ss Start Year' - )->addColumn( - 'po_number', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Po Number' - )->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' - )->addColumn( - 'cc_ss_issue', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Ss Issue' - )->addColumn( - 'additional_information', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Information' - )->addIndex( - $installer->getIdxName('quote_payment', ['quote_id']), - ['quote_id'] - )->addForeignKey( - $installer->getFkName('quote_payment', 'quote_id', 'quote', 'entity_id'), - 'quote_id', - $installer->getTable('quote'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Quote Payment' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'quote_shipping_rate' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('quote_shipping_rate') - )->addColumn( - 'rate_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rate Id' - )->addColumn( - 'address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Address 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( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], - 'Updated At' - )->addColumn( - 'carrier', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Carrier' - )->addColumn( - 'carrier_title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Carrier Title' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Code' - )->addColumn( - 'method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Method' - )->addColumn( - 'method_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Method Description' - )->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' - )->addColumn( - 'error_message', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Error Message' - )->addColumn( - 'method_title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Method Title' - )->addIndex( - $installer->getIdxName('quote_shipping_rate', ['address_id']), - ['address_id'] - )->addForeignKey( - $installer->getFkName('quote_shipping_rate', 'address_id', 'quote_address', 'address_id'), - 'address_id', - $installer->getTable('quote_address'), - 'address_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Quote Shipping Rate' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $installer->startSetup(); + + /** + * Create table 'quote' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store 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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'converted_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Converted At' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '1'], + 'Is Active' + )->addColumn( + 'is_virtual', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Is Virtual' + )->addColumn( + 'is_multi_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Is Multi Shipping' + )->addColumn( + 'items_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Items Count' + )->addColumn( + 'items_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Items Qty' + )->addColumn( + 'orig_order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Orig Order Id' + )->addColumn( + 'store_to_base_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Store To Base Rate' + )->addColumn( + 'store_to_quote_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Store To Quote Rate' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Base Currency Code' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Store Currency Code' + )->addColumn( + 'quote_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Quote Currency Code' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Grand Total' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Grand Total' + )->addColumn( + 'checkout_method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Checkout Method' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Customer Id' + )->addColumn( + 'customer_tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Customer Tax Class Id' + )->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => '0'], + 'Customer Group Id' + )->addColumn( + 'customer_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Email' + )->addColumn( + 'customer_prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Customer Prefix' + )->addColumn( + 'customer_firstname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Firstname' + )->addColumn( + 'customer_middlename', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Customer Middlename' + )->addColumn( + 'customer_lastname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Lastname' + )->addColumn( + 'customer_suffix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Customer Suffix' + )->addColumn( + 'customer_dob', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Customer Dob' + )->addColumn( + 'customer_note', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Note' + )->addColumn( + 'customer_note_notify', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '1'], + 'Customer Note Notify' + )->addColumn( + 'customer_is_guest', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Customer Is Guest' + )->addColumn( + 'remote_ip', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Remote Ip' + )->addColumn( + 'applied_rule_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Applied Rule Ids' + )->addColumn( + 'reserved_order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => true], + 'Reserved Order Id' + )->addColumn( + 'password_hash', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Password Hash' + )->addColumn( + 'coupon_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Coupon Code' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Global Currency Code' + )->addColumn( + 'base_to_global_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Global Rate' + )->addColumn( + 'base_to_quote_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Quote Rate' + )->addColumn( + 'customer_taxvat', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Taxvat' + )->addColumn( + 'customer_gender', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Gender' + )->addColumn( + 'subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal' + )->addColumn( + 'base_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal' + )->addColumn( + 'subtotal_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal With Discount' + )->addColumn( + 'base_subtotal_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal With Discount' + )->addColumn( + 'is_changed', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Is Changed' + )->addColumn( + 'trigger_recollect', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Trigger Recollect' + )->addColumn( + 'ext_shipping_info', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Ext Shipping Info' + )->addIndex( + $installer->getIdxName('quote', ['customer_id', 'store_id', 'is_active']), + ['customer_id', 'store_id', 'is_active'] + )->addIndex( + $installer->getIdxName('quote', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('quote', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_address' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_address') + )->addColumn( + 'address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Address Id' + )->addColumn( + 'quote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Quote 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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer Id' + )->addColumn( + 'save_in_address_book', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['default' => '0'], + 'Save In Address Book' + )->addColumn( + 'customer_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer Address Id' + )->addColumn( + 'address_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Address Type' + )->addColumn( + 'email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Email' + )->addColumn( + 'prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Prefix' + )->addColumn( + 'firstname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Firstname' + )->addColumn( + 'middlename', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Middlename' + )->addColumn( + 'lastname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Lastname' + )->addColumn( + 'suffix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + [], + 'Suffix' + )->addColumn( + 'company', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Company' + )->addColumn( + 'street', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Street' + )->addColumn( + 'city', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'City' + )->addColumn( + 'region', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Region' + )->addColumn( + 'region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Region Id' + )->addColumn( + 'postcode', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Postcode' + )->addColumn( + 'country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Country Id' + )->addColumn( + 'telephone', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Phone Number' + )->addColumn( + 'fax', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Fax' + )->addColumn( + 'same_as_billing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Same As Billing' + )->addColumn( + 'collect_shipping_rates', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Collect Shipping Rates' + )->addColumn( + 'shipping_method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Method' + )->addColumn( + 'shipping_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Description' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Weight' + )->addColumn( + 'subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Subtotal' + )->addColumn( + 'base_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Subtotal' + )->addColumn( + 'subtotal_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Subtotal With Discount' + )->addColumn( + 'base_subtotal_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Subtotal With Discount' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Tax Amount' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Tax Amount' + )->addColumn( + 'shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Shipping Amount' + )->addColumn( + 'base_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Shipping Amount' + )->addColumn( + 'shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Tax Amount' + )->addColumn( + 'base_shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Tax Amount' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Discount Amount' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Grand Total' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Grand Total' + )->addColumn( + 'customer_notes', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Customer Notes' + )->addColumn( + 'applied_taxes', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Applied Taxes' + )->addColumn( + 'discount_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Discount Description' + )->addColumn( + 'shipping_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Discount Amount' + )->addColumn( + 'base_shipping_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Discount Amount' + )->addColumn( + 'subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Incl Tax' + )->addColumn( + 'base_subtotal_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Total Incl Tax' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'shipping_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Hidden Tax Amount' + )->addColumn( + 'base_shipping_hidden_tax_amnt', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Hidden Tax Amount' + )->addColumn( + 'shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Incl Tax' + )->addColumn( + 'base_shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Incl Tax' + )->addIndex( + $installer->getIdxName('quote_address', ['quote_id']), + ['quote_id'] + )->addForeignKey( + $installer->getFkName('quote_address', 'quote_id', 'quote', 'entity_id'), + 'quote_id', + $installer->getTable('quote'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Address' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_item') + )->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Item Id' + )->addColumn( + 'quote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Quote Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'parent_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Item Id' + )->addColumn( + 'is_virtual', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Virtual' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'applied_rule_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Applied Rule Ids' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'is_qty_decimal', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Qty Decimal' + )->addColumn( + 'no_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'No Discount' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Weight' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + )->addColumn( + 'base_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Price' + )->addColumn( + 'custom_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Custom Price' + )->addColumn( + 'discount_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Percent' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Discount Amount' + )->addColumn( + 'tax_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Percent' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Amount' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Tax Amount' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Row Total' + )->addColumn( + 'base_row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Row Total' + )->addColumn( + 'row_total_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Row Total With Discount' + )->addColumn( + 'row_weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Row Weight' + )->addColumn( + 'product_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Product Type' + )->addColumn( + 'base_tax_before_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Before Discount' + )->addColumn( + 'tax_before_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Before Discount' + )->addColumn( + 'original_custom_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Original Custom Price' + )->addColumn( + 'redirect_url', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Redirect Url' + )->addColumn( + 'base_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Cost' + )->addColumn( + 'price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price Incl Tax' + )->addColumn( + 'base_price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price Incl Tax' + )->addColumn( + 'row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total Incl Tax' + )->addColumn( + 'base_row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total Incl Tax' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addIndex( + $installer->getIdxName('quote_item', ['parent_item_id']), + ['parent_item_id'] + )->addIndex( + $installer->getIdxName('quote_item', ['product_id']), + ['product_id'] + )->addIndex( + $installer->getIdxName('quote_item', ['quote_id']), + ['quote_id'] + )->addIndex( + $installer->getIdxName('quote_item', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('quote_item', 'parent_item_id', 'quote_item', 'item_id'), + 'parent_item_id', + $installer->getTable('quote_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('quote_item', 'quote_id', 'quote', 'entity_id'), + 'quote_id', + $installer->getTable('quote'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('quote_item', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_address_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_address_item') + )->addColumn( + 'address_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Address Item Id' + )->addColumn( + 'parent_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Item Id' + )->addColumn( + 'quote_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Quote Address Id' + )->addColumn( + 'quote_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Quote Item 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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'applied_rule_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Applied Rule Ids' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Weight' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Amount' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Row Total' + )->addColumn( + 'base_row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Row Total' + )->addColumn( + 'row_total_with_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Row Total With Discount' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Discount Amount' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Tax Amount' + )->addColumn( + 'row_weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Row Weight' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'super_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Super Product Id' + )->addColumn( + 'parent_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Product Id' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addColumn( + 'image', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Image' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'is_qty_decimal', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Is Qty Decimal' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + )->addColumn( + 'discount_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Percent' + )->addColumn( + 'no_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'No Discount' + )->addColumn( + 'tax_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Percent' + )->addColumn( + 'base_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price' + )->addColumn( + 'base_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Cost' + )->addColumn( + 'price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price Incl Tax' + )->addColumn( + 'base_price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price Incl Tax' + )->addColumn( + 'row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total Incl Tax' + )->addColumn( + 'base_row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total Incl Tax' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addIndex( + $installer->getIdxName('quote_address_item', ['quote_address_id']), + ['quote_address_id'] + )->addIndex( + $installer->getIdxName('quote_address_item', ['parent_item_id']), + ['parent_item_id'] + )->addIndex( + $installer->getIdxName('quote_address_item', ['quote_item_id']), + ['quote_item_id'] + )->addForeignKey( + $installer->getFkName( + 'quote_address_item', + 'quote_address_id', + 'quote_address', + 'address_id' + ), + 'quote_address_id', + $installer->getTable('quote_address'), + 'address_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName( + 'quote_address_item', + 'parent_item_id', + 'quote_address_item', + 'address_item_id' + ), + 'parent_item_id', + $installer->getTable('quote_address_item'), + 'address_item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('quote_address_item', 'quote_item_id', 'quote_item', 'item_id'), + 'quote_item_id', + $installer->getTable('quote_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Address Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_item_option' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_item_option') + )->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Id' + )->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Item Id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Product Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Code' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Value' + )->addIndex( + $installer->getIdxName('quote_item_option', ['item_id']), + ['item_id'] + )->addForeignKey( + $installer->getFkName('quote_item_option', 'item_id', 'quote_item', 'item_id'), + 'item_id', + $installer->getTable('quote_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Item Option' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_payment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_payment') + )->addColumn( + 'payment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Payment Id' + )->addColumn( + 'quote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Quote 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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Method' + )->addColumn( + 'cc_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Type' + )->addColumn( + 'cc_number_enc', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Number Enc' + )->addColumn( + 'cc_last_4', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Last 4' + )->addColumn( + 'cc_cid_enc', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Cid Enc' + )->addColumn( + 'cc_owner', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Owner' + )->addColumn( + 'cc_exp_month', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['unsigned' => true, 'default' => null, 'nullable' => true], + 'Cc Exp Month' + )->addColumn( + 'cc_exp_year', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Cc Exp Year' + )->addColumn( + 'cc_ss_owner', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Ss Owner' + )->addColumn( + 'cc_ss_start_month', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Cc Ss Start Month' + )->addColumn( + 'cc_ss_start_year', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Cc Ss Start Year' + )->addColumn( + 'po_number', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Po Number' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'cc_ss_issue', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Ss Issue' + )->addColumn( + 'additional_information', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Information' + )->addIndex( + $installer->getIdxName('quote_payment', ['quote_id']), + ['quote_id'] + )->addForeignKey( + $installer->getFkName('quote_payment', 'quote_id', 'quote', 'entity_id'), + 'quote_id', + $installer->getTable('quote'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Payment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'quote_shipping_rate' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('quote_shipping_rate') + )->addColumn( + 'rate_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rate Id' + )->addColumn( + 'address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Address 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( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + 'Updated At' + )->addColumn( + 'carrier', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Carrier' + )->addColumn( + 'carrier_title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Carrier Title' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Code' + )->addColumn( + 'method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Method' + )->addColumn( + 'method_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Method Description' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + )->addColumn( + 'error_message', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Error Message' + )->addColumn( + 'method_title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Method Title' + )->addIndex( + $installer->getIdxName('quote_shipping_rate', ['address_id']), + ['address_id'] + )->addForeignKey( + $installer->getFkName('quote_shipping_rate', 'address_id', 'quote_address', 'address_id'), + 'address_id', + $installer->getTable('quote_address'), + 'address_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Quote Shipping Rate' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Reports/Setup/InstallSchema.php b/app/code/Magento/Reports/Setup/InstallSchema.php index 53c3724a6104c..d2bfde242736e 100644 --- a/app/code/Magento/Reports/Setup/InstallSchema.php +++ b/app/code/Magento/Reports/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'report_compared_product_index'. - * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that - * only one record is added when customer/visitor compares same product again. - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('report_compared_product_index')) - ->addColumn( - 'index_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Index Id' - ) - ->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Visitor Id' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer 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], - 'Store Id' - ) - ->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Added At' - ) - ->addIndex( - $installer->getIdxName( - 'report_compared_product_index', - ['visitor_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['visitor_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName( - 'report_compared_product_index', - ['customer_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['customer_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['added_at']), - ['added_at'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Reports Compared Product Index Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'report_viewed_product_index' - * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that - * only one record is added when customer/visitor views same product again. - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('report_viewed_product_index')) - ->addColumn( - 'index_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Index Id' - ) - ->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Visitor Id' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer 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], - 'Store Id' - ) - ->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Added At' - ) - ->addIndex( - $installer->getIdxName( - 'report_viewed_product_index', - ['visitor_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['visitor_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName( - 'report_viewed_product_index', - ['customer_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['customer_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['added_at']), - ['added_at'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Reports Viewed Product Index Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'report_event_types' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('report_event_types')) - ->addColumn( - 'event_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Event Type Id' - ) - ->addColumn( - 'event_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => false], - 'Event Name' - ) - ->addColumn( - 'customer_login', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Login' - ) - ->setComment('Reports Event Type Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'report_event' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('report_event')) - ->addColumn( - 'event_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Event Id' - ) - ->addColumn( - 'logged_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Logged At' - ) - ->addColumn( - 'event_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Event Type Id' - ) - ->addColumn( - 'object_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Object Id' - ) - ->addColumn( - 'subject_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Subject Id' - ) - ->addColumn( - 'subtype', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Subtype' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' - ) - ->addIndex( - $installer->getIdxName('report_event', ['event_type_id']), - ['event_type_id'] - ) - ->addIndex( - $installer->getIdxName('report_event', ['subject_id']), - ['subject_id'] - ) - ->addIndex( - $installer->getIdxName('report_event', ['object_id']), - ['object_id'] - ) - ->addIndex( - $installer->getIdxName('report_event', ['subtype']), - ['subtype'] - ) - ->addIndex( - $installer->getIdxName('report_event', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('report_event', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_event', 'event_type_id', 'report_event_types', 'event_type_id'), - 'event_type_id', - $installer->getTable('report_event_types'), - 'event_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Reports Event Table'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'report_compared_product_index'. - * MySQL table differs by having unique keys on (customer/visitor, product) columns and is created - * in separate install. - */ - $tableName = $installer->getTable('report_compared_product_index'); - if (!$installer->tableExists($tableName)) { - $table = $installer->getConnection() - ->newTable($tableName) - ->addColumn( - 'index_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Index Id' - ) - ->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Visitor Id' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer 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], - 'Store Id' - ) - ->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Added At' - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['visitor_id', 'product_id']), - ['visitor_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['customer_id', 'product_id']), - ['customer_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['added_at']), - ['added_at'] - ) - ->addIndex( - $installer->getIdxName('report_compared_product_index', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Reports Compared Product Index Table'); - $installer->getConnection()->createTable($table); - } - - /** - * Create table 'report_viewed_product_index'. - * MySQL table differs by having unique keys on (customer/visitor, product) columns and is created - * in separate install. - */ - $tableName = $installer->getTable('report_viewed_product_index'); - if (!$installer->tableExists($tableName)) { - $table = $installer->getConnection() - ->newTable($tableName) - ->addColumn( - 'index_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Index Id' - ) - ->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Visitor Id' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer 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], - 'Store Id' - ) - ->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Added At' - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['visitor_id', 'product_id']), - ['visitor_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['customer_id', 'product_id']), - ['customer_id', 'product_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['added_at']), - ['added_at'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_index', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Reports Viewed Product Index Table'); - $installer->getConnection()->createTable($table); - } - - /** - * Create table 'report_viewed_product_aggregated_daily'. - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('report_viewed_product_aggregated_daily')) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - ) - ->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - ) - ->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' - ) - ->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' - ) - ->addColumn( - 'views_num', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Number of Views' - ) - ->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' - ) - ->addIndex( - $installer->getIdxName( - 'report_viewed_product_aggregated_daily', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_daily', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_daily', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_aggregated_daily', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'report_viewed_product_aggregated_daily', - 'product_id', - 'catalog_product_entity', - 'entity_id' - ), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Most Viewed Products Aggregated Daily'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'report_viewed_product_aggregated_monthly'. - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('report_viewed_product_aggregated_monthly')) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - ) - ->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - ) - ->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' - ) - ->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' - ) - ->addColumn( - 'views_num', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Number of Views' - ) - ->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' - ) - ->addIndex( - $installer->getIdxName( - 'report_viewed_product_aggregated_monthly', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_monthly', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_monthly', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_aggregated_monthly', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'report_viewed_product_aggregated_monthly', - 'product_id', - 'catalog_product_entity', - 'entity_id' - ), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Most Viewed Products Aggregated Monthly'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'report_viewed_product_aggregated_yearly'. - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('report_viewed_product_aggregated_yearly')) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - ) - ->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - ) - ->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' - ) - ->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' - ) - ->addColumn( - 'views_num', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Number of Views' - ) - ->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' - ) - ->addIndex( - $installer->getIdxName( - 'report_viewed_product_aggregated_yearly', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_yearly', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('report_viewed_product_aggregated_yearly', ['product_id']), - ['product_id'] - ) - ->addForeignKey( - $installer->getFkName('report_viewed_product_aggregated_yearly', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName( - 'report_viewed_product_aggregated_yearly', - 'product_id', - 'catalog_product_entity', - 'entity_id' - ), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Most Viewed Products Aggregated Yearly'); - $installer->getConnection()->createTable($table); - - /* - * Prepare database for tables install - */ - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + /* + * Prepare database for tables install + */ + $installer->startSetup(); + + /** + * Create table 'report_compared_product_index'. + * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that + * only one record is added when customer/visitor compares same product again. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_compared_product_index')) + ->addColumn( + 'index_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Index Id' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Visitor Id' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer 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], + 'Store Id' + ) + ->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Added At' + ) + ->addIndex( + $installer->getIdxName( + 'report_compared_product_index', + ['visitor_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['visitor_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName( + 'report_compared_product_index', + ['customer_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['customer_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['added_at']), + ['added_at'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Reports Compared Product Index Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_viewed_product_index' + * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that + * only one record is added when customer/visitor views same product again. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_viewed_product_index')) + ->addColumn( + 'index_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Index Id' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Visitor Id' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer 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], + 'Store Id' + ) + ->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Added At' + ) + ->addIndex( + $installer->getIdxName( + 'report_viewed_product_index', + ['visitor_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['visitor_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName( + 'report_viewed_product_index', + ['customer_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['customer_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['added_at']), + ['added_at'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Reports Viewed Product Index Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_event_types' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_event_types')) + ->addColumn( + 'event_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Event Type Id' + ) + ->addColumn( + 'event_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => false], + 'Event Name' + ) + ->addColumn( + 'customer_login', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Login' + ) + ->setComment('Reports Event Type Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_event' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_event')) + ->addColumn( + 'event_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Event Id' + ) + ->addColumn( + 'logged_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Logged At' + ) + ->addColumn( + 'event_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Event Type Id' + ) + ->addColumn( + 'object_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Object Id' + ) + ->addColumn( + 'subject_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Subject Id' + ) + ->addColumn( + 'subtype', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Subtype' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + ) + ->addIndex( + $installer->getIdxName('report_event', ['event_type_id']), + ['event_type_id'] + ) + ->addIndex( + $installer->getIdxName('report_event', ['subject_id']), + ['subject_id'] + ) + ->addIndex( + $installer->getIdxName('report_event', ['object_id']), + ['object_id'] + ) + ->addIndex( + $installer->getIdxName('report_event', ['subtype']), + ['subtype'] + ) + ->addIndex( + $installer->getIdxName('report_event', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('report_event', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_event', 'event_type_id', 'report_event_types', 'event_type_id'), + 'event_type_id', + $installer->getTable('report_event_types'), + 'event_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Reports Event Table'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_compared_product_index'. + * MySQL table differs by having unique keys on (customer/visitor, product) columns and is created + * in separate install. + */ + $tableName = $installer->getTable('report_compared_product_index'); + if (!$installer->tableExists($tableName)) { + $table = $installer->getConnection() + ->newTable($tableName) + ->addColumn( + 'index_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Index Id' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Visitor Id' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer 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], + 'Store Id' + ) + ->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Added At' + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['visitor_id', 'product_id']), + ['visitor_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['customer_id', 'product_id']), + ['customer_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['added_at']), + ['added_at'] + ) + ->addIndex( + $installer->getIdxName('report_compared_product_index', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', + 'customer_id', + 'customer_entity', + 'entity_id' + ), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Reports Compared Product Index Table'); + $installer->getConnection()->createTable($table); + } + + /** + * Create table 'report_viewed_product_index'. + * MySQL table differs by having unique keys on (customer/visitor, product) columns and is created + * in separate install. + */ + $tableName = $installer->getTable('report_viewed_product_index'); + if (!$installer->tableExists($tableName)) { + $table = $installer->getConnection() + ->newTable($tableName) + ->addColumn( + 'index_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Index Id' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Visitor Id' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer 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], + 'Store Id' + ) + ->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Added At' + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['visitor_id', 'product_id']), + ['visitor_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['customer_id', 'product_id']), + ['customer_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['added_at']), + ['added_at'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_index', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Reports Viewed Product Index Table'); + $installer->getConnection()->createTable($table); + } + + /** + * Create table 'report_viewed_product_aggregated_daily'. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_viewed_product_aggregated_daily')) + ->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + ) + ->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + ) + ->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + ) + ->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + ) + ->addColumn( + 'views_num', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Number of Views' + ) + ->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + ) + ->addIndex( + $installer->getIdxName( + 'report_viewed_product_aggregated_daily', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_daily', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_daily', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_aggregated_daily', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'report_viewed_product_aggregated_daily', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Most Viewed Products Aggregated Daily'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_viewed_product_aggregated_monthly'. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_viewed_product_aggregated_monthly')) + ->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + ) + ->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + ) + ->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + ) + ->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + ) + ->addColumn( + 'views_num', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Number of Views' + ) + ->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + ) + ->addIndex( + $installer->getIdxName( + 'report_viewed_product_aggregated_monthly', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_monthly', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_monthly', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_aggregated_monthly', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'report_viewed_product_aggregated_monthly', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Most Viewed Products Aggregated Monthly'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'report_viewed_product_aggregated_yearly'. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('report_viewed_product_aggregated_yearly')) + ->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + ) + ->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + ) + ->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + ) + ->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + ) + ->addColumn( + 'views_num', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Number of Views' + ) + ->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + ) + ->addIndex( + $installer->getIdxName( + 'report_viewed_product_aggregated_yearly', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_yearly', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('report_viewed_product_aggregated_yearly', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('report_viewed_product_aggregated_yearly', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'report_viewed_product_aggregated_yearly', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Most Viewed Products Aggregated Yearly'); + $installer->getConnection()->createTable($table); + + /* + * Prepare database for tables install + */ + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Review/Setup/InstallSchema.php b/app/code/Magento/Review/Setup/InstallSchema.php index 12c684845ff92..8b79e04f69349 100644 --- a/app/code/Magento/Review/Setup/InstallSchema.php +++ b/app/code/Magento/Review/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - /** - * Create table 'review_entity' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('review_entity')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Review entity id' - ) - ->addColumn( - 'entity_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Review entity code' - ) - ->setComment('Review entities'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'review_status' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('review_status')) - ->addColumn( - 'status_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Status id' - ) - ->addColumn( - 'status_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Status code' - ) - ->setComment('Review statuses'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'review' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('review')) - ->addColumn( - 'review_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Review id' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Review create date' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity id' - ) - ->addColumn( - 'entity_pk_value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product id' - ) - ->addColumn( - 'status_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Status code' - ) - ->addIndex( - $installer->getIdxName('review', ['entity_id']), - ['entity_id'] - ) - ->addIndex( - $installer->getIdxName('review', ['status_id']), - ['status_id'] - ) - ->addIndex( - $installer->getIdxName('review', ['entity_pk_value']), - ['entity_pk_value'] - ) - ->addForeignKey( - $installer->getFkName('review', 'entity_id', 'review_entity', 'entity_id'), - 'entity_id', - $installer->getTable('review_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('review', 'status_id', 'review_status', 'status_id'), - 'status_id', - $installer->getTable('review_status'), - 'status_id', - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION - ) - ->setComment('Review base information'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'review_detail' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('review_detail')) - ->addColumn( - 'detail_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Review detail id' - ) - ->addColumn( - 'review_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Review id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Store id' - ) - ->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Title' - ) - ->addColumn( - 'detail', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => false], - 'Detail description' - ) - ->addColumn( - 'nickname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 128, - ['nullable' => false], - 'User nickname' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer Id' - ) - ->addIndex( - $installer->getIdxName('review_detail', ['review_id']), - ['review_id'] - ) - ->addIndex( - $installer->getIdxName('review_detail', ['store_id']), - ['store_id'] - ) - ->addIndex( - $installer->getIdxName('review_detail', ['customer_id']), - ['customer_id'] - ) - ->addForeignKey( - $installer->getFkName('review_detail', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('review_detail', 'review_id', 'review', 'review_id'), - 'review_id', - $installer->getTable('review'), - 'review_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('review_detail', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Review detail information'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'review_entity_summary' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('review_entity_summary')) - ->addColumn( - 'primary_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Summary review entity id' - ) - ->addColumn( - 'entity_pk_value', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['nullable' => false, 'default' => '0'], - 'Product id' - ) - ->addColumn( - 'entity_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Entity type id' - ) - ->addColumn( - 'reviews_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Qty of reviews' - ) - ->addColumn( - 'rating_summary', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Summarized rating' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store id' - ) - ->addIndex( - $installer->getIdxName('review_entity_summary', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('review_entity_summary', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Review aggregates'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'review_store' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('review_store')) - ->addColumn( - 'review_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Review Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store Id' - ) - ->addIndex( - $installer->getIdxName('review_store', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('review_store', 'review_id', 'review', 'review_id'), - 'review_id', - $installer->getTable('review'), - 'review_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('review_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Review Store'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'rating_entity' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('rating_entity')) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - ) - ->addColumn( - 'entity_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => false], - 'Entity Code' - ) - ->addIndex( - $installer->getIdxName( - 'rating_entity', - ['entity_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['entity_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->setComment('Rating entities'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'rating' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('rating')) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rating Id' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Entity Id' - ) - ->addColumn( - 'rating_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - ['nullable' => false], - 'Rating Code' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Rating Position On Frontend' - ) - ->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 1], - 'Rating is active.' - ) - ->addIndex( - $installer->getIdxName( - 'rating', - ['rating_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['rating_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('rating', ['entity_id']), - ['entity_id'] - ) - ->addForeignKey( - $installer->getFkName('rating', 'entity_id', 'rating_entity', 'entity_id'), - 'entity_id', - $installer->getTable('rating_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Ratings'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'rating_option' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('rating_option')) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rating Option Id' - ) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Rating Id' - ) - ->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Rating Option Code' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Rating Option Value' - ) - ->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Ration option position on frontend' - ) - ->addIndex( - $installer->getIdxName('rating_option', ['rating_id']), - ['rating_id'] - ) - ->addForeignKey( - $installer->getFkName('rating_option', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Rating options'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'rating_option_vote' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('rating_option_vote')) - ->addColumn( - 'vote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Vote id' - ) - ->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Vote option id' - ) - ->addColumn( - 'remote_ip', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 16, - ['nullable' => false], - 'Customer IP' - ) - ->addColumn( - 'remote_ip_long', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['nullable' => false, 'default' => 0], - 'Customer IP converted to long integer format' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'default' => 0], - 'Customer Id' - ) - ->addColumn( - 'entity_pk_value', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Product id' - ) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Rating id' - ) - ->addColumn( - 'review_id', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true], - 'Review id' - ) - ->addColumn( - 'percent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0], - 'Percent amount' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0], - 'Vote option value' - ) - ->addIndex( - $installer->getIdxName('rating_option_vote', ['option_id']), - ['option_id'] - ) - ->addForeignKey( - $installer->getFkName('rating_option_vote', 'option_id', 'rating_option', 'option_id'), - 'option_id', - $installer->getTable('rating_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('rating_option_vote', 'review_id', 'review', 'review_id'), - 'review_id', - $installer->getTable('review'), - 'review_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Rating option values'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'rating_option_vote_aggregated' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('rating_option_vote_aggregated')) - ->addColumn( - 'primary_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Vote aggregation id' - ) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Rating id' - ) - ->addColumn( - 'entity_pk_value', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Product id' - ) - ->addColumn( - 'vote_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Vote dty' - ) - ->addColumn( - 'vote_value_sum', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'General vote sum' - ) - ->addColumn( - 'percent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0], - 'Vote percent' - ) - ->addColumn( - 'percent_approved', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['default' => '0'], - 'Vote percent approved by admin' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Store Id' - ) - ->addIndex( - $installer->getIdxName('rating_option_vote_aggregated', ['rating_id']), - ['rating_id'] - ) - ->addIndex( - $installer->getIdxName('rating_option_vote_aggregated', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('rating_option_vote_aggregated', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('rating_option_vote_aggregated', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Rating vote aggregated'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'rating_store' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('rating_store')) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], - 'Rating id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], - 'Store id' - ) - ->addIndex( - $installer->getIdxName('rating_store', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('rating_store', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('rating_store', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION - ) - ->setComment('Rating Store'); - $installer->getConnection()->createTable($table); - - /** - * Create table 'rating_title' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('rating_title')) - ->addColumn( - 'rating_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], - 'Rating Id' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], - 'Store Id' - ) - ->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Rating Label' - ) - ->addIndex( - $installer->getIdxName('rating_title', ['store_id']), - ['store_id'] - ) - ->addForeignKey( - $installer->getFkName('rating_title', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $installer->getFkName('rating_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Rating Title'); - $installer->getConnection()->createTable($table); - - $setup->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + /** + * Create table 'review_entity' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review_entity')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Review entity id' + ) + ->addColumn( + 'entity_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Review entity code' + ) + ->setComment('Review entities'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'review_status' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review_status')) + ->addColumn( + 'status_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Status id' + ) + ->addColumn( + 'status_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Status code' + ) + ->setComment('Review statuses'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'review' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review')) + ->addColumn( + 'review_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Review id' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Review create date' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity id' + ) + ->addColumn( + 'entity_pk_value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product id' + ) + ->addColumn( + 'status_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Status code' + ) + ->addIndex( + $installer->getIdxName('review', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('review', ['status_id']), + ['status_id'] + ) + ->addIndex( + $installer->getIdxName('review', ['entity_pk_value']), + ['entity_pk_value'] + ) + ->addForeignKey( + $installer->getFkName('review', 'entity_id', 'review_entity', 'entity_id'), + 'entity_id', + $installer->getTable('review_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('review', 'status_id', 'review_status', 'status_id'), + 'status_id', + $installer->getTable('review_status'), + 'status_id', + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + ) + ->setComment('Review base information'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'review_detail' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review_detail')) + ->addColumn( + 'detail_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Review detail id' + ) + ->addColumn( + 'review_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Review id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Store id' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Title' + ) + ->addColumn( + 'detail', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => false], + 'Detail description' + ) + ->addColumn( + 'nickname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 128, + ['nullable' => false], + 'User nickname' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer Id' + ) + ->addIndex( + $installer->getIdxName('review_detail', ['review_id']), + ['review_id'] + ) + ->addIndex( + $installer->getIdxName('review_detail', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('review_detail', ['customer_id']), + ['customer_id'] + ) + ->addForeignKey( + $installer->getFkName('review_detail', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('review_detail', 'review_id', 'review', 'review_id'), + 'review_id', + $installer->getTable('review'), + 'review_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('review_detail', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Review detail information'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'review_entity_summary' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review_entity_summary')) + ->addColumn( + 'primary_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Summary review entity id' + ) + ->addColumn( + 'entity_pk_value', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['nullable' => false, 'default' => '0'], + 'Product id' + ) + ->addColumn( + 'entity_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Entity type id' + ) + ->addColumn( + 'reviews_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Qty of reviews' + ) + ->addColumn( + 'rating_summary', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Summarized rating' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store id' + ) + ->addIndex( + $installer->getIdxName('review_entity_summary', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('review_entity_summary', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Review aggregates'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'review_store' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('review_store')) + ->addColumn( + 'review_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Review Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store Id' + ) + ->addIndex( + $installer->getIdxName('review_store', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('review_store', 'review_id', 'review', 'review_id'), + 'review_id', + $installer->getTable('review'), + 'review_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('review_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Review Store'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_entity' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_entity')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + ) + ->addColumn( + 'entity_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => false], + 'Entity Code' + ) + ->addIndex( + $installer->getIdxName( + 'rating_entity', + ['entity_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->setComment('Rating entities'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating')) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rating Id' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Entity Id' + ) + ->addColumn( + 'rating_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + ['nullable' => false], + 'Rating Code' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Rating Position On Frontend' + ) + ->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 1], + 'Rating is active.' + ) + ->addIndex( + $installer->getIdxName( + 'rating', + ['rating_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['rating_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('rating', ['entity_id']), + ['entity_id'] + ) + ->addForeignKey( + $installer->getFkName('rating', 'entity_id', 'rating_entity', 'entity_id'), + 'entity_id', + $installer->getTable('rating_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Ratings'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_option' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_option')) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rating Option Id' + ) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Rating Id' + ) + ->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Rating Option Code' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Rating Option Value' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Ration option position on frontend' + ) + ->addIndex( + $installer->getIdxName('rating_option', ['rating_id']), + ['rating_id'] + ) + ->addForeignKey( + $installer->getFkName('rating_option', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Rating options'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_option_vote' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_option_vote')) + ->addColumn( + 'vote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Vote id' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Vote option id' + ) + ->addColumn( + 'remote_ip', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 16, + ['nullable' => false], + 'Customer IP' + ) + ->addColumn( + 'remote_ip_long', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['nullable' => false, 'default' => 0], + 'Customer IP converted to long integer format' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'default' => 0], + 'Customer Id' + ) + ->addColumn( + 'entity_pk_value', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Product id' + ) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Rating id' + ) + ->addColumn( + 'review_id', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true], + 'Review id' + ) + ->addColumn( + 'percent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0], + 'Percent amount' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0], + 'Vote option value' + ) + ->addIndex( + $installer->getIdxName('rating_option_vote', ['option_id']), + ['option_id'] + ) + ->addForeignKey( + $installer->getFkName('rating_option_vote', 'option_id', 'rating_option', 'option_id'), + 'option_id', + $installer->getTable('rating_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('rating_option_vote', 'review_id', 'review', 'review_id'), + 'review_id', + $installer->getTable('review'), + 'review_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Rating option values'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_option_vote_aggregated' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_option_vote_aggregated')) + ->addColumn( + 'primary_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Vote aggregation id' + ) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Rating id' + ) + ->addColumn( + 'entity_pk_value', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Product id' + ) + ->addColumn( + 'vote_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Vote dty' + ) + ->addColumn( + 'vote_value_sum', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'General vote sum' + ) + ->addColumn( + 'percent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0], + 'Vote percent' + ) + ->addColumn( + 'percent_approved', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['default' => '0'], + 'Vote percent approved by admin' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Store Id' + ) + ->addIndex( + $installer->getIdxName('rating_option_vote_aggregated', ['rating_id']), + ['rating_id'] + ) + ->addIndex( + $installer->getIdxName('rating_option_vote_aggregated', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('rating_option_vote_aggregated', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('rating_option_vote_aggregated', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Rating vote aggregated'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_store' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_store')) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], + 'Rating id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], + 'Store id' + ) + ->addIndex( + $installer->getIdxName('rating_store', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('rating_store', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('rating_store', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + ) + ->setComment('Rating Store'); + $installer->getConnection()->createTable($table); + + /** + * Create table 'rating_title' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('rating_title')) + ->addColumn( + 'rating_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], + 'Rating Id' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true], + 'Store Id' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Rating Label' + ) + ->addIndex( + $installer->getIdxName('rating_title', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('rating_title', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('rating_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Rating Title'); + $installer->getConnection()->createTable($table); + + $setup->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Sales/Setup/InstallSchema.php b/app/code/Magento/Sales/Setup/InstallSchema.php index 28896824845f1..35906a79d3874 100644 --- a/app/code/Magento/Sales/Setup/InstallSchema.php +++ b/app/code/Magento/Sales/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'sales_order' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'State' - )->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Status' - )->addColumn( - 'coupon_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Coupon Code' - )->addColumn( - 'protect_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Protect Code' - )->addColumn( - 'shipping_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Description' - )->addColumn( - 'is_virtual', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Virtual' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer Id' - )->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Amount' - )->addColumn( - 'base_discount_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Canceled' - )->addColumn( - 'base_discount_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Invoiced' - )->addColumn( - 'base_discount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Refunded' - )->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' - )->addColumn( - 'base_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Amount' - )->addColumn( - 'base_shipping_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Canceled' - )->addColumn( - 'base_shipping_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Invoiced' - )->addColumn( - 'base_shipping_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Refunded' - )->addColumn( - 'base_shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Tax Amount' - )->addColumn( - 'base_shipping_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Tax Refunded' - )->addColumn( - 'base_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal' - )->addColumn( - 'base_subtotal_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Canceled' - )->addColumn( - 'base_subtotal_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Invoiced' - )->addColumn( - 'base_subtotal_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Refunded' - )->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Amount' - )->addColumn( - 'base_tax_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Canceled' - )->addColumn( - 'base_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Invoiced' - )->addColumn( - 'base_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Refunded' - )->addColumn( - 'base_to_global_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Global Rate' - )->addColumn( - 'base_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Order Rate' - )->addColumn( - 'base_total_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Canceled' - )->addColumn( - 'base_total_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Invoiced' - )->addColumn( - 'base_total_invoiced_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Invoiced Cost' - )->addColumn( - 'base_total_offline_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Offline Refunded' - )->addColumn( - 'base_total_online_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Online Refunded' - )->addColumn( - 'base_total_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Paid' - )->addColumn( - 'base_total_qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Qty Ordered' - )->addColumn( - 'base_total_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Refunded' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Amount' - )->addColumn( - 'discount_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Canceled' - )->addColumn( - 'discount_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Invoiced' - )->addColumn( - 'discount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Refunded' - )->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' - )->addColumn( - 'shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Amount' - )->addColumn( - 'shipping_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Canceled' - )->addColumn( - 'shipping_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Invoiced' - )->addColumn( - 'shipping_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Refunded' - )->addColumn( - 'shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Tax Amount' - )->addColumn( - 'shipping_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Tax Refunded' - )->addColumn( - 'store_to_base_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Base Rate' - )->addColumn( - 'store_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Order Rate' - )->addColumn( - 'subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal' - )->addColumn( - 'subtotal_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Canceled' - )->addColumn( - 'subtotal_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Invoiced' - )->addColumn( - 'subtotal_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Refunded' - )->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Amount' - )->addColumn( - 'tax_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Canceled' - )->addColumn( - 'tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Invoiced' - )->addColumn( - 'tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Refunded' - )->addColumn( - 'total_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Canceled' - )->addColumn( - 'total_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Invoiced' - )->addColumn( - 'total_offline_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Offline Refunded' - )->addColumn( - 'total_online_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Online Refunded' - )->addColumn( - 'total_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Paid' - )->addColumn( - 'total_qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Qty Ordered' - )->addColumn( - 'total_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Refunded' - )->addColumn( - 'can_ship_partially', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Can Ship Partially' - )->addColumn( - 'can_ship_partially_item', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Can Ship Partially Item' - )->addColumn( - 'customer_is_guest', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Customer Is Guest' - )->addColumn( - 'customer_note_notify', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Customer Note Notify' - )->addColumn( - 'billing_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Billing Address Id' - )->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - [], - 'Customer Group Id' - )->addColumn( - 'edit_increment', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Edit Increment' - )->addColumn( - 'email_sent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Email Sent' - )->addColumn( - 'forced_shipment_with_invoice', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Forced Do Shipment With Invoice' - )->addColumn( - 'payment_auth_expiration', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Payment Authorization Expiration' - )->addColumn( - 'quote_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Quote Address Id' - )->addColumn( - 'quote_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Quote Id' - )->addColumn( - 'shipping_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipping Address Id' - )->addColumn( - 'adjustment_negative', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Adjustment Negative' - )->addColumn( - 'adjustment_positive', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Adjustment Positive' - )->addColumn( - 'base_adjustment_negative', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Adjustment Negative' - )->addColumn( - 'base_adjustment_positive', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Adjustment Positive' - )->addColumn( - 'base_shipping_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Discount Amount' - )->addColumn( - 'base_subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Incl Tax' - )->addColumn( - 'base_total_due', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Due' - )->addColumn( - 'payment_authorization_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Payment Authorization Amount' - )->addColumn( - 'shipping_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Discount Amount' - )->addColumn( - 'subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Incl Tax' - )->addColumn( - 'total_due', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Due' - )->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Weight' - )->addColumn( - 'customer_dob', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'Customer Dob' - )->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' - )->addColumn( - 'applied_rule_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Applied Rule Ids' - )->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' - )->addColumn( - 'customer_email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Email' - )->addColumn( - 'customer_firstname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Firstname' - )->addColumn( - 'customer_lastname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Lastname' - )->addColumn( - 'customer_middlename', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Middlename' - )->addColumn( - 'customer_prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Prefix' - )->addColumn( - 'customer_suffix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Suffix' - )->addColumn( - 'customer_taxvat', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Customer Taxvat' - )->addColumn( - 'discount_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Discount Description' - )->addColumn( - 'ext_customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Ext Customer Id' - )->addColumn( - 'ext_order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Ext Order Id' - )->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Global Currency Code' - )->addColumn( - 'hold_before_state', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Hold Before State' - )->addColumn( - 'hold_before_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Hold Before Status' - )->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Order Currency Code' - )->addColumn( - 'original_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Original Increment Id' - )->addColumn( - 'relation_child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Relation Child Id' - )->addColumn( - 'relation_child_real_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Relation Child Real Id' - )->addColumn( - 'relation_parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Relation Parent Id' - )->addColumn( - 'relation_parent_real_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Relation Parent Real Id' - )->addColumn( - 'remote_ip', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Remote Ip' - )->addColumn( - 'shipping_method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Method' - )->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Store Currency Code' - )->addColumn( - 'store_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Store Name' - )->addColumn( - 'x_forwarded_for', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'X Forwarded For' - )->addColumn( - 'customer_note', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Customer Note' - )->addColumn( - '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_UPDATE], - 'Updated At' - )->addColumn( - 'total_item_count', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Total Item Count' - )->addColumn( - 'customer_gender', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Customer Gender' - )->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' - )->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' - )->addColumn( - 'shipping_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Hidden Tax Amount' - )->addColumn( - 'base_shipping_hidden_tax_amnt', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Hidden Tax Amount' - )->addColumn( - 'hidden_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Invoiced' - )->addColumn( - 'base_hidden_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Invoiced' - )->addColumn( - 'hidden_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Refunded' - )->addColumn( - 'base_hidden_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Refunded' - )->addColumn( - 'shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Incl Tax' - )->addColumn( - 'base_shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Incl Tax' - )->addColumn( - 'coupon_rule_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Coupon Sales Rule Name' - )->addIndex( - $installer->getIdxName('sales_order', ['status']), - ['status'] - )->addIndex( - $installer->getIdxName('sales_order', ['state']), - ['state'] - )->addIndex( - $installer->getIdxName('sales_order', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName( - 'sales_order', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_order', ['created_at']), - ['created_at'] - )->addIndex( - $installer->getIdxName('sales_order', ['customer_id']), - ['customer_id'] - )->addIndex( - $installer->getIdxName('sales_order', ['ext_order_id']), - ['ext_order_id'] - )->addIndex( - $installer->getIdxName('sales_order', ['quote_id']), - ['quote_id'] - )->addIndex( - $installer->getIdxName('sales_order', ['updated_at']), - ['updated_at'] - )->addForeignKey( - $installer->getFkName('sales_order', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_order', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Order' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_order_grid' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_grid') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Status' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'store_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Store Name' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Customer Id' - )->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' - )->addColumn( - 'base_total_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Paid' - )->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' - )->addColumn( - 'total_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Paid' - )->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' - )->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' - )->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Order Currency Code' - )->addColumn( - 'shipping_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Name' - )->addColumn( - 'billing_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Billing Name' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' - )->addIndex( - $installer->getIdxName('sales_order_grid', ['status']), - ['status'] - )->addIndex( - $installer->getIdxName('sales_order_grid', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('sales_order_grid', ['base_grand_total']), - ['base_grand_total'] - )->addIndex( - $installer->getIdxName('sales_order_grid', ['base_total_paid']), - ['base_total_paid'] - )->addIndex( - $installer->getIdxName('sales_order_grid', ['grand_total']), - ['grand_total'] - )->addIndex( - $installer->getIdxName('sales_order_grid', ['total_paid']), - ['total_paid'] - )->addIndex( - $installer->getIdxName( - 'sales_order_grid', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_order_grid', ['shipping_name']), - ['shipping_name'] - )->addIndex( - $installer->getIdxName('sales_order_grid', ['billing_name']), - ['billing_name'] - )->addIndex( - $installer->getIdxName('sales_order_grid', ['created_at']), - ['created_at'] - )->addIndex( - $installer->getIdxName('sales_order_grid', ['customer_id']), - ['customer_id'] - )->addIndex( - $installer->getIdxName('sales_order_grid', ['updated_at']), - ['updated_at'] - )->addForeignKey( - $installer->getFkName('sales_order_grid', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_order_grid', 'entity_id', 'sales_order', 'entity_id'), - 'entity_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_order_grid', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Order Grid' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_order_address' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_address') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Id' - )->addColumn( - 'customer_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Customer Address Id' - )->addColumn( - 'quote_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Quote Address Id' - )->addColumn( - 'region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Region Id' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Customer Id' - )->addColumn( - 'fax', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Fax' - )->addColumn( - 'region', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Region' - )->addColumn( - 'postcode', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Postcode' - )->addColumn( - 'lastname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Lastname' - )->addColumn( - 'street', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Street' - )->addColumn( - 'city', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'City' - )->addColumn( - 'email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Email' - )->addColumn( - 'telephone', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Phone Number' - )->addColumn( - 'country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - [], - 'Country Id' - )->addColumn( - 'firstname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Firstname' - )->addColumn( - 'address_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Address Type' - )->addColumn( - 'prefix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Prefix' - )->addColumn( - 'middlename', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Middlename' - )->addColumn( - 'suffix', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Suffix' - )->addColumn( - 'company', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Company' - )->addIndex( - $installer->getIdxName('sales_order_address', ['parent_id']), - ['parent_id'] - )->addForeignKey( - $installer->getFkName('sales_order_address', 'parent_id', 'sales_order', 'entity_id'), - 'parent_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Order Address' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_order_status_history' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_status_history') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - )->addColumn( - 'is_customer_notified', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Is Customer Notified' - )->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible On Front' - )->addColumn( - 'comment', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Comment' - )->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Status' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addColumn( - 'entity_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true], - 'Shows what entity history is bind to.' - )->addIndex( - $installer->getIdxName('sales_order_status_history', ['parent_id']), - ['parent_id'] - )->addIndex( - $installer->getIdxName('sales_order_status_history', ['created_at']), - ['created_at'] - )->addForeignKey( - $installer->getFkName('sales_order_status_history', 'parent_id', 'sales_order', 'entity_id'), - 'parent_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Order Status History' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_order_item' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_item') - )->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Item Id' - )->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Order Id' - )->addColumn( - 'parent_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Item Id' - )->addColumn( - 'quote_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Quote Item Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Updated At' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - )->addColumn( - 'product_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Product Type' - )->addColumn( - 'product_options', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Product Options' - )->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Weight' - )->addColumn( - 'is_virtual', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Virtual' - )->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' - )->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - )->addColumn( - 'applied_rule_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Applied Rule Ids' - )->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' - )->addColumn( - 'is_qty_decimal', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Qty Decimal' - )->addColumn( - 'no_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'No Discount' - )->addColumn( - 'qty_backordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Backordered' - )->addColumn( - 'qty_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Canceled' - )->addColumn( - 'qty_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Invoiced' - )->addColumn( - 'qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Ordered' - )->addColumn( - 'qty_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Refunded' - )->addColumn( - 'qty_shipped', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Qty Shipped' - )->addColumn( - 'base_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Cost' - )->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Price' - )->addColumn( - 'base_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Price' - )->addColumn( - 'original_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Original Price' - )->addColumn( - 'base_original_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Original Price' - )->addColumn( - 'tax_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Percent' - )->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Amount' - )->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Tax Amount' - )->addColumn( - 'tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Tax Invoiced' - )->addColumn( - 'base_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Tax Invoiced' - )->addColumn( - 'discount_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Percent' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Amount' - )->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Discount Amount' - )->addColumn( - 'discount_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Discount Invoiced' - )->addColumn( - 'base_discount_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Discount Invoiced' - )->addColumn( - 'amount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Amount Refunded' - )->addColumn( - 'base_amount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Base Amount Refunded' - )->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Row Total' - )->addColumn( - 'base_row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Row Total' - )->addColumn( - 'row_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Row Invoiced' - )->addColumn( - 'base_row_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Base Row Invoiced' - )->addColumn( - 'row_weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['default' => '0.0000'], - 'Row Weight' - )->addColumn( - 'base_tax_before_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Before Discount' - )->addColumn( - 'tax_before_discount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Before Discount' - )->addColumn( - 'ext_order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Ext Order Item Id' - )->addColumn( - 'locked_do_invoice', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Locked Do Invoice' - )->addColumn( - 'locked_do_ship', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Locked Do Ship' - )->addColumn( - 'price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price Incl Tax' - )->addColumn( - 'base_price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price Incl Tax' - )->addColumn( - 'row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total Incl Tax' - )->addColumn( - 'base_row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total Incl Tax' - )->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' - )->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' - )->addColumn( - 'hidden_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Invoiced' - )->addColumn( - 'base_hidden_tax_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Invoiced' - )->addColumn( - 'hidden_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Refunded' - )->addColumn( - 'base_hidden_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Refunded' - )->addColumn( - 'tax_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Canceled' - )->addColumn( - 'hidden_tax_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Canceled' - )->addColumn( - 'tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Refunded' - )->addColumn( - 'base_tax_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Refunded' - )->addColumn( - 'discount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Refunded' - )->addColumn( - 'base_discount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Refunded' - )->addIndex( - $installer->getIdxName('sales_order_item', ['order_id']), - ['order_id'] - )->addIndex( - $installer->getIdxName('sales_order_item', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('sales_order_item', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_order_item', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Order Item' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_order_payment' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_payment') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - )->addColumn( - 'base_shipping_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Captured' - )->addColumn( - 'shipping_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Captured' - )->addColumn( - 'amount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount Refunded' - )->addColumn( - 'base_amount_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Paid' - )->addColumn( - 'amount_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount Canceled' - )->addColumn( - 'base_amount_authorized', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Authorized' - )->addColumn( - 'base_amount_paid_online', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Paid Online' - )->addColumn( - 'base_amount_refunded_online', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Refunded Online' - )->addColumn( - 'base_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Amount' - )->addColumn( - 'shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Amount' - )->addColumn( - 'amount_paid', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount Paid' - )->addColumn( - 'amount_authorized', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount Authorized' - )->addColumn( - 'base_amount_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Ordered' - )->addColumn( - 'base_shipping_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Refunded' - )->addColumn( - 'shipping_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Refunded' - )->addColumn( - 'base_amount_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Refunded' - )->addColumn( - 'amount_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount Ordered' - )->addColumn( - 'base_amount_canceled', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount Canceled' - )->addColumn( - 'quote_payment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Quote Payment Id' - )->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' - )->addColumn( - 'cc_exp_month', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Exp Month' - )->addColumn( - 'cc_ss_start_year', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Ss Start Year' - )->addColumn( - 'echeck_bank_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Echeck Bank Name' - )->addColumn( - 'method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Method' - )->addColumn( - 'cc_debug_request_body', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Debug Request Body' - )->addColumn( - 'cc_secure_verify', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Secure Verify' - )->addColumn( - 'protection_eligibility', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Protection Eligibility' - )->addColumn( - 'cc_approval', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Approval' - )->addColumn( - 'cc_last_4', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Last 4' - )->addColumn( - 'cc_status_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Status Description' - )->addColumn( - 'echeck_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Echeck Type' - )->addColumn( - 'cc_debug_response_serialized', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Debug Response Serialized' - )->addColumn( - 'cc_ss_start_month', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Ss Start Month' - )->addColumn( - 'echeck_account_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Echeck Account Type' - )->addColumn( - 'last_trans_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Last Trans Id' - )->addColumn( - 'cc_cid_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Cid Status' - )->addColumn( - 'cc_owner', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Owner' - )->addColumn( - 'cc_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Type' - )->addColumn( - 'po_number', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Po Number' - )->addColumn( - 'cc_exp_year', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true, 'default' => null], - 'Cc Exp Year' - )->addColumn( - 'cc_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Status' - )->addColumn( - 'echeck_routing_number', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Echeck Routing Number' - )->addColumn( - 'account_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Account Status' - )->addColumn( - 'anet_trans_method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Anet Trans Method' - )->addColumn( - 'cc_debug_response_body', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Debug Response Body' - )->addColumn( - 'cc_ss_issue', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Ss Issue' - )->addColumn( - 'echeck_account_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Echeck Account Name' - )->addColumn( - 'cc_avs_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Avs Status' - )->addColumn( - 'cc_number_enc', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Number Enc' - )->addColumn( - 'cc_trans_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Cc Trans Id' - )->addColumn( - 'address_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Address Status' - )->addColumn( - 'additional_information', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Information' - )->addIndex( - $installer->getIdxName('sales_order_payment', ['parent_id']), - ['parent_id'] - )->addForeignKey( - $installer->getFkName('sales_order_payment', 'parent_id', 'sales_order', 'entity_id'), - 'parent_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Order Payment' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_shipment' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipment') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'total_weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Weight' - )->addColumn( - 'total_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Qty' - )->addColumn( - 'email_sent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Email Sent' - )->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Customer Id' - )->addColumn( - 'shipping_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipping Address Id' - )->addColumn( - 'billing_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Billing Address Id' - )->addColumn( - 'shipment_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipment Status' - )->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' - )->addColumn( - 'packages', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '20000', - [], - 'Packed Products in Packages' - )->addColumn( - 'shipping_label', - \Magento\Framework\DB\Ddl\Table::TYPE_VARBINARY, - '2m', - [], - 'Shipping Label Content' - )->addIndex( - $installer->getIdxName('sales_shipment', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('sales_shipment', ['total_qty']), - ['total_qty'] - )->addIndex( - $installer->getIdxName( - 'sales_shipment', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_shipment', ['order_id']), - ['order_id'] - )->addIndex( - $installer->getIdxName('sales_shipment', ['created_at']), - ['created_at'] - )->addIndex( - $installer->getIdxName('sales_shipment', ['updated_at']), - ['updated_at'] - )->addForeignKey( - $installer->getFkName('sales_shipment', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_shipment', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Shipment' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_shipment_grid' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipment_grid') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'total_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Qty' - )->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' - )->addColumn( - 'shipment_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipment Status' - )->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' - )->addColumn( - 'order_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Increment Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addColumn( - 'order_created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Order Created At' - )->addColumn( - 'shipping_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Name' - )->addIndex( - $installer->getIdxName('sales_shipment_grid', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('sales_shipment_grid', ['total_qty']), - ['total_qty'] - )->addIndex( - $installer->getIdxName('sales_shipment_grid', ['order_id']), - ['order_id'] - )->addIndex( - $installer->getIdxName('sales_shipment_grid', ['shipment_status']), - ['shipment_status'] - )->addIndex( - $installer->getIdxName( - 'sales_shipment_grid', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_shipment_grid', ['order_increment_id']), - ['order_increment_id'] - )->addIndex( - $installer->getIdxName('sales_shipment_grid', ['created_at']), - ['created_at'] - )->addIndex( - $installer->getIdxName('sales_shipment_grid', ['order_created_at']), - ['order_created_at'] - )->addIndex( - $installer->getIdxName('sales_shipment_grid', ['shipping_name']), - ['shipping_name'] - )->addForeignKey( - $installer->getFkName('sales_shipment_grid', 'entity_id', 'sales_shipment', 'entity_id'), - 'entity_id', - $installer->getTable('sales_shipment'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_shipment_grid', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Shipment Grid' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_shipment_item' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipment_item') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - )->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total' - )->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - )->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Weight' - )->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Qty' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Product Id' - )->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Order Item Id' - )->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' - )->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' - )->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' - )->addIndex( - $installer->getIdxName('sales_shipment_item', ['parent_id']), - ['parent_id'] - )->addForeignKey( - $installer->getFkName('sales_shipment_item', 'parent_id', 'sales_shipment', 'entity_id'), - 'parent_id', - $installer->getTable('sales_shipment'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Shipment Item' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_shipment_track' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipment_track') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - )->addColumn( - 'weight', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Weight' - )->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Qty' - )->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' - )->addColumn( - 'track_number', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Number' - )->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - )->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Title' - )->addColumn( - 'carrier_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Carrier Code' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' - )->addIndex( - $installer->getIdxName('sales_shipment_track', ['parent_id']), - ['parent_id'] - )->addIndex( - $installer->getIdxName('sales_shipment_track', ['order_id']), - ['order_id'] - )->addIndex( - $installer->getIdxName('sales_shipment_track', ['created_at']), - ['created_at'] - )->addForeignKey( - $installer->getFkName('sales_shipment_track', 'parent_id', 'sales_shipment', 'entity_id'), - 'parent_id', - $installer->getTable('sales_shipment'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Shipment Track' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_shipment_comment' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipment_comment') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - )->addColumn( - 'is_customer_notified', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Is Customer Notified' - )->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible On Front' - )->addColumn( - 'comment', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Comment' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addIndex( - $installer->getIdxName('sales_shipment_comment', ['created_at']), - ['created_at'] - )->addIndex( - $installer->getIdxName('sales_shipment_comment', ['parent_id']), - ['parent_id'] - )->addForeignKey( - $installer->getFkName('sales_shipment_comment', 'parent_id', 'sales_shipment', 'entity_id'), - 'parent_id', - $installer->getTable('sales_shipment'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Shipment Comment' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_invoice' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoice') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true, 'identity' => true], - 'Entity Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' - )->addColumn( - 'shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Tax Amount' - )->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Amount' - )->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Amount' - )->addColumn( - 'store_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Order Rate' - )->addColumn( - 'base_shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Tax Amount' - )->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Amount' - )->addColumn( - 'base_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Order Rate' - )->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' - )->addColumn( - 'shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Amount' - )->addColumn( - 'subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Incl Tax' - )->addColumn( - 'base_subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Incl Tax' - )->addColumn( - 'store_to_base_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Base Rate' - )->addColumn( - 'base_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Amount' - )->addColumn( - 'total_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Qty' - )->addColumn( - 'base_to_global_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Global Rate' - )->addColumn( - 'subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal' - )->addColumn( - 'base_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Amount' - )->addColumn( - 'billing_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Billing Address Id' - )->addColumn( - 'is_used_for_refund', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Used For Refund' - )->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' - )->addColumn( - 'email_sent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Email Sent' - )->addColumn( - 'can_void_flag', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Can Void Flag' - )->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'State' - )->addColumn( - 'shipping_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipping Address Id' - )->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Store Currency Code' - )->addColumn( - 'transaction_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Transaction Id' - )->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Order Currency Code' - )->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' - )->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Global Currency Code' - )->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' - )->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' - )->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' - )->addColumn( - 'shipping_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Hidden Tax Amount' - )->addColumn( - 'base_shipping_hidden_tax_amnt', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Hidden Tax Amount' - )->addColumn( - 'shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Incl Tax' - )->addColumn( - 'base_shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Incl Tax' - )->addColumn( - 'base_total_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Total Refunded' - )->addColumn( - 'discount_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Discount Description' - )->addIndex( - $installer->getIdxName('sales_invoice', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('sales_invoice', ['grand_total']), - ['grand_total'] - )->addIndex( - $installer->getIdxName('sales_invoice', ['order_id']), - ['order_id'] - )->addIndex( - $installer->getIdxName('sales_invoice', ['state']), - ['state'] - )->addIndex( - $installer->getIdxName( - 'sales_invoice', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_invoice', ['created_at']), - ['created_at'] - )->addForeignKey( - $installer->getFkName('sales_invoice', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_invoice', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Invoice' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_invoice_grid' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoice_grid') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' - )->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' - )->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' - )->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'State' - )->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Store Currency Code' - )->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Order Currency Code' - )->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' - )->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Global Currency Code' - )->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' - )->addColumn( - 'order_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Increment Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addColumn( - 'order_created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Order Created At' - )->addColumn( - 'billing_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Billing Name' - )->addIndex( - $installer->getIdxName('sales_invoice_grid', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('sales_invoice_grid', ['grand_total']), - ['grand_total'] - )->addIndex( - $installer->getIdxName('sales_invoice_grid', ['order_id']), - ['order_id'] - )->addIndex( - $installer->getIdxName('sales_invoice_grid', ['state']), - ['state'] - )->addIndex( - $installer->getIdxName( - 'sales_invoice_grid', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_invoice_grid', ['order_increment_id']), - ['order_increment_id'] - )->addIndex( - $installer->getIdxName('sales_invoice_grid', ['created_at']), - ['created_at'] - )->addIndex( - $installer->getIdxName('sales_invoice_grid', ['order_created_at']), - ['order_created_at'] - )->addIndex( - $installer->getIdxName('sales_invoice_grid', ['billing_name']), - ['billing_name'] - )->addForeignKey( - $installer->getFkName('sales_invoice_grid', 'entity_id', 'sales_invoice', 'entity_id'), - 'entity_id', - $installer->getTable('sales_invoice'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_invoice_grid', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Invoice Grid' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_invoice_item' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoice_item') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - )->addColumn( - 'base_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price' - )->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Amount' - )->addColumn( - 'base_row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Amount' - )->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total' - )->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Amount' - )->addColumn( - 'price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price Incl Tax' - )->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Amount' - )->addColumn( - 'base_price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price Incl Tax' - )->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Qty' - )->addColumn( - 'base_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Cost' - )->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - )->addColumn( - 'base_row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total Incl Tax' - )->addColumn( - 'row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total Incl Tax' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Product Id' - )->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Order Item Id' - )->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' - )->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - )->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' - )->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' - )->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' - )->addColumn( - 'tax_ratio', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 512, - [], - 'Ratio of tax invoiced over tax of the order item' - )->addIndex( - $installer->getIdxName('sales_invoice_item', ['parent_id']), - ['parent_id'] - )->addForeignKey( - $installer->getFkName('sales_invoice_item', 'parent_id', 'sales_invoice', 'entity_id'), - 'parent_id', - $installer->getTable('sales_invoice'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Invoice Item' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_invoice_comment' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoice_comment') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - )->addColumn( - 'is_customer_notified', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Customer Notified' - )->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible On Front' - )->addColumn( - 'comment', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Comment' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addIndex( - $installer->getIdxName('sales_invoice_comment', ['created_at']), - ['created_at'] - )->addIndex( - $installer->getIdxName('sales_invoice_comment', ['parent_id']), - ['parent_id'] - )->addForeignKey( - $installer->getFkName('sales_invoice_comment', 'parent_id', 'sales_invoice', 'entity_id'), - 'parent_id', - $installer->getTable('sales_invoice'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Invoice Comment' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_creditmemo' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_creditmemo') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'adjustment_positive', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Adjustment Positive' - )->addColumn( - 'base_shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Tax Amount' - )->addColumn( - 'store_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Order Rate' - )->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Amount' - )->addColumn( - 'base_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Order Rate' - )->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' - )->addColumn( - 'base_adjustment_negative', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Adjustment Negative' - )->addColumn( - 'base_subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal Incl Tax' - )->addColumn( - 'shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Amount' - )->addColumn( - 'subtotal_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal Incl Tax' - )->addColumn( - 'adjustment_negative', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Adjustment Negative' - )->addColumn( - 'base_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Amount' - )->addColumn( - 'store_to_base_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Base Rate' - )->addColumn( - 'base_to_global_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Global Rate' - )->addColumn( - 'base_adjustment', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Adjustment' - )->addColumn( - 'base_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Subtotal' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Amount' - )->addColumn( - 'subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Subtotal' - )->addColumn( - 'adjustment', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Adjustment' - )->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' - )->addColumn( - 'base_adjustment_positive', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Adjustment Positive' - )->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Amount' - )->addColumn( - 'shipping_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Tax Amount' - )->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Amount' - )->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' - )->addColumn( - 'email_sent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Email Sent' - )->addColumn( - 'creditmemo_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Creditmemo Status' - )->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'State' - )->addColumn( - 'shipping_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Shipping Address Id' - )->addColumn( - 'billing_address_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Billing Address Id' - )->addColumn( - 'invoice_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Invoice Id' - )->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Store Currency Code' - )->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Order Currency Code' - )->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' - )->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Global Currency Code' - )->addColumn( - 'transaction_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Transaction Id' - )->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Updated At' - )->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' - )->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' - )->addColumn( - 'shipping_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Hidden Tax Amount' - )->addColumn( - 'base_shipping_hidden_tax_amnt', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Hidden Tax Amount' - )->addColumn( - 'shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Shipping Incl Tax' - )->addColumn( - 'base_shipping_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Shipping Incl Tax' - )->addColumn( - 'discount_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Discount Description' - )->addIndex( - $installer->getIdxName('sales_creditmemo', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('sales_creditmemo', ['order_id']), - ['order_id'] - )->addIndex( - $installer->getIdxName('sales_creditmemo', ['creditmemo_status']), - ['creditmemo_status'] - )->addIndex( - $installer->getIdxName( - 'sales_creditmemo', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_creditmemo', ['state']), - ['state'] - )->addIndex( - $installer->getIdxName('sales_creditmemo', ['created_at']), - ['created_at'] - )->addForeignKey( - $installer->getFkName('sales_creditmemo', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_creditmemo', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Creditmemo' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_creditmemo_grid' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_creditmemo_grid') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'store_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Order Rate' - )->addColumn( - 'base_to_order_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Order Rate' - )->addColumn( - 'grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Grand Total' - )->addColumn( - 'store_to_base_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Store To Base Rate' - )->addColumn( - 'base_to_global_rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base To Global Rate' - )->addColumn( - 'base_grand_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Grand Total' - )->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' - )->addColumn( - 'creditmemo_status', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Creditmemo Status' - )->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'State' - )->addColumn( - 'invoice_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Invoice Id' - )->addColumn( - 'store_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Store Currency Code' - )->addColumn( - 'order_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Order Currency Code' - )->addColumn( - 'base_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Base Currency Code' - )->addColumn( - 'global_currency_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3, - [], - 'Global Currency Code' - )->addColumn( - 'increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Increment Id' - )->addColumn( - 'order_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Increment Id' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addColumn( - 'order_created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Order Created At' - )->addColumn( - 'billing_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Billing Name' - )->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['grand_total']), - ['grand_total'] - )->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['base_grand_total']), - ['base_grand_total'] - )->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['order_id']), - ['order_id'] - )->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['creditmemo_status']), - ['creditmemo_status'] - )->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['state']), - ['state'] - )->addIndex( - $installer->getIdxName( - 'sales_creditmemo_grid', - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['order_increment_id']), - ['order_increment_id'] - )->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['created_at']), - ['created_at'] - )->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['order_created_at']), - ['order_created_at'] - )->addIndex( - $installer->getIdxName('sales_creditmemo_grid', ['billing_name']), - ['billing_name'] - )->addForeignKey( - $installer->getFkName('sales_creditmemo_grid', 'entity_id', 'sales_creditmemo', 'entity_id'), - 'entity_id', - $installer->getTable('sales_creditmemo'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_creditmemo_grid', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Creditmemo Grid' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_creditmemo_item' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_creditmemo_item') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - )->addColumn( - 'base_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price' - )->addColumn( - 'tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Tax Amount' - )->addColumn( - 'base_row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Discount Amount' - )->addColumn( - 'row_total', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total' - )->addColumn( - 'base_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Discount Amount' - )->addColumn( - 'price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price Incl Tax' - )->addColumn( - 'base_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Tax Amount' - )->addColumn( - 'base_price_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Price Incl Tax' - )->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Qty' - )->addColumn( - 'base_cost', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Cost' - )->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Price' - )->addColumn( - 'base_row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Row Total Incl Tax' - )->addColumn( - 'row_total_incl_tax', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Row Total Incl Tax' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Product Id' - )->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Order Item Id' - )->addColumn( - 'additional_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Additional Data' - )->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - )->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sku' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' - )->addColumn( - 'hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Hidden Tax Amount' - )->addColumn( - 'base_hidden_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Hidden Tax Amount' - )->addColumn( - 'tax_ratio', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 512, - [], - 'Ratio of tax in the creditmemo item over tax of the order item' - )->addIndex( - $installer->getIdxName('sales_creditmemo_item', ['parent_id']), - ['parent_id'] - )->addForeignKey( - $installer->getFkName('sales_creditmemo_item', 'parent_id', 'sales_creditmemo', 'entity_id'), - 'parent_id', - $installer->getTable('sales_creditmemo'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Creditmemo Item' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_creditmemo_comment' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_creditmemo_comment') - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Parent Id' - )->addColumn( - 'is_customer_notified', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Is Customer Notified' - )->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Visible On Front' - )->addColumn( - 'comment', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Comment' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addIndex( - $installer->getIdxName('sales_creditmemo_comment', ['created_at']), - ['created_at'] - )->addIndex( - $installer->getIdxName('sales_creditmemo_comment', ['parent_id']), - ['parent_id'] - )->addForeignKey( - $installer->getFkName('sales_creditmemo_comment', 'parent_id', 'sales_creditmemo', 'entity_id'), - 'parent_id', - $installer->getTable('sales_creditmemo'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Flat Creditmemo Comment' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_invoiced_aggregated' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoiced_aggregated') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' - )->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' - )->addColumn( - 'orders_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Orders Invoiced' - )->addColumn( - 'invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced' - )->addColumn( - 'invoiced_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced Captured' - )->addColumn( - 'invoiced_not_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced Not Captured' - )->addIndex( - $installer->getIdxName( - 'sales_invoiced_aggregated', - ['period', 'store_id', 'order_status'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_invoiced_aggregated', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Invoiced Aggregated' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_invoiced_aggregated_order' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_invoiced_aggregated_order') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false, 'default' => false], - 'Order Status' - )->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' - )->addColumn( - 'orders_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Orders Invoiced' - )->addColumn( - 'invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced' - )->addColumn( - 'invoiced_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced Captured' - )->addColumn( - 'invoiced_not_captured', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Invoiced Not Captured' - )->addIndex( - $installer->getIdxName( - 'sales_invoiced_aggregated_order', - ['period', 'store_id', 'order_status'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_invoiced_aggregated_order', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Invoiced Aggregated Order' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_order_aggregated_created' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_aggregated_created') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false, 'default' => false], - 'Order Status' - )->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' - )->addColumn( - 'total_qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Qty Ordered' - )->addColumn( - 'total_qty_invoiced', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Qty Invoiced' - )->addColumn( - 'total_income_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Income Amount' - )->addColumn( - 'total_revenue_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Revenue Amount' - )->addColumn( - 'total_profit_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Profit Amount' - )->addColumn( - 'total_invoiced_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Invoiced Amount' - )->addColumn( - 'total_canceled_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Canceled Amount' - )->addColumn( - 'total_paid_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Paid Amount' - )->addColumn( - 'total_refunded_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Refunded Amount' - )->addColumn( - 'total_tax_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Tax Amount' - )->addColumn( - 'total_tax_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Tax Amount Actual' - )->addColumn( - 'total_shipping_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Shipping Amount' - )->addColumn( - 'total_shipping_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Shipping Amount Actual' - )->addColumn( - 'total_discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Discount Amount' - )->addColumn( - 'total_discount_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Total Discount Amount Actual' - )->addIndex( - $installer->getIdxName( - 'sales_order_aggregated_created', - ['period', 'store_id', 'order_status'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_order_aggregated_created', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Order Aggregated Created' - ); - $installer->getConnection()->createTable($table); - - $installer->getConnection()->createTable( - $installer->getConnection()->createTableByDdl( - $installer->getTable('sales_order_aggregated_created'), - $installer->getTable('sales_order_aggregated_updated') - ) - ); - - /** - * Create table 'sales_payment_transaction' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_payment_transaction') - )->addColumn( - 'transaction_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Transaction Id' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Parent Id' - )->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Order Id' - )->addColumn( - 'payment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Payment Id' - )->addColumn( - 'txn_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - [], - 'Txn Id' - )->addColumn( - 'parent_txn_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - [], - 'Parent Txn Id' - )->addColumn( - 'txn_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 15, - [], - 'Txn Type' - )->addColumn( - 'is_closed', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Closed' - )->addColumn( - 'additional_information', - \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, - '64K', - [], - 'Additional Information' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Created At' - )->addIndex( - $installer->getIdxName( - 'sales_payment_transaction', - ['order_id', 'payment_id', 'txn_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['order_id', 'payment_id', 'txn_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_payment_transaction', ['parent_id']), - ['parent_id'] - )->addIndex( - $installer->getIdxName('sales_payment_transaction', ['payment_id']), - ['payment_id'] - )->addForeignKey( - $installer->getFkName('sales_payment_transaction', 'order_id', 'sales_order', 'entity_id'), - 'order_id', - $installer->getTable('sales_order'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_payment_transaction', 'parent_id', 'sales_payment_transaction', 'transaction_id'), - 'parent_id', - $installer->getTable('sales_payment_transaction'), - 'transaction_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_payment_transaction', 'payment_id', 'sales_order_payment', 'entity_id'), - 'payment_id', - $installer->getTable('sales_order_payment'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Payment Transaction' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_refunded_aggregated' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_refunded_aggregated') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false, 'default' => false], - 'Order Status' - )->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' - )->addColumn( - 'refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Refunded' - )->addColumn( - 'online_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Online Refunded' - )->addColumn( - 'offline_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Offline Refunded' - )->addIndex( - $installer->getIdxName( - 'sales_refunded_aggregated', - ['period', 'store_id', 'order_status'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_refunded_aggregated', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Refunded Aggregated' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_refunded_aggregated_order' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_refunded_aggregated_order') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' - )->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' - )->addColumn( - 'refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Refunded' - )->addColumn( - 'online_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Online Refunded' - )->addColumn( - 'offline_refunded', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Offline Refunded' - )->addIndex( - $installer->getIdxName( - 'sales_refunded_aggregated_order', - ['period', 'store_id', 'order_status'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_refunded_aggregated_order', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Refunded Aggregated Order' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_shipping_aggregated' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipping_aggregated') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' - )->addColumn( - 'shipping_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Description' - )->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' - )->addColumn( - 'total_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Shipping' - )->addColumn( - 'total_shipping_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Shipping Actual' - )->addIndex( - $installer->getIdxName( - 'sales_shipping_aggregated', - ['period', 'store_id', 'order_status', 'shipping_description'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status', 'shipping_description'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_shipping_aggregated', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Shipping Aggregated' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_shipping_aggregated_order' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_shipping_aggregated_order') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' - )->addColumn( - 'shipping_description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Shipping Description' - )->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Orders Count' - )->addColumn( - 'total_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Shipping' - )->addColumn( - 'total_shipping_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Total Shipping Actual' - )->addIndex( - $installer->getIdxName( - 'sales_shipping_aggregated_order', - ['period', 'store_id', 'order_status', 'shipping_description'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status', 'shipping_description'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_shipping_aggregated_order', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Shipping Aggregated Order' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_bestsellers_aggregated_daily' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_bestsellers_aggregated_daily') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - )->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' - )->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' - )->addColumn( - 'qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty Ordered' - )->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' - )->addIndex( - $installer->getIdxName( - 'sales_bestsellers_aggregated_daily', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_daily', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_daily', ['product_id']), - ['product_id'] - )->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_daily', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Bestsellers Aggregated Daily' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_bestsellers_aggregated_monthly' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_bestsellers_aggregated_monthly') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - )->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' - )->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' - )->addColumn( - 'qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty Ordered' - )->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' - )->addIndex( - $installer->getIdxName( - 'sales_bestsellers_aggregated_monthly', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_monthly', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_monthly', ['product_id']), - ['product_id'] - )->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_monthly', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Bestsellers Aggregated Monthly' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_bestsellers_aggregated_yearly' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_bestsellers_aggregated_yearly') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Product Id' - )->addColumn( - 'product_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Product Name' - )->addColumn( - 'product_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Product Price' - )->addColumn( - 'qty_ordered', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false, 'default' => '0.0000'], - 'Qty Ordered' - )->addColumn( - 'rating_pos', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rating Pos' - )->addIndex( - $installer->getIdxName( - 'sales_bestsellers_aggregated_yearly', - ['period', 'store_id', 'product_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'product_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_yearly', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('sales_bestsellers_aggregated_yearly', ['product_id']), - ['product_id'] - )->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_yearly', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Bestsellers Aggregated Yearly' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_order_tax' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_tax') - )->addColumn( - 'tax_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Tax Id' - )->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Order Id' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Code' - )->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Title' - )->addColumn( - 'percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Percent' - )->addColumn( - 'amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Amount' - )->addColumn( - 'priority', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Priority' - )->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Position' - )->addColumn( - 'base_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Amount' - )->addColumn( - 'process', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false], - 'Process' - )->addColumn( - 'base_real_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - [], - 'Base Real Amount' - )->addColumn( - 'hidden', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Hidden' - )->addIndex( - $installer->getIdxName('sales_order_tax', ['order_id', 'priority', 'position']), - ['order_id', 'priority', 'position'] - )->setComment( - 'Sales Order Tax Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_order_status' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_status') - )->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Status' - )->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 128, - ['nullable' => false], - 'Label' - )->setComment( - 'Sales Order Status Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_order_status_state' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_status_state') - )->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Status' - )->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Label' - )->addColumn( - 'is_default', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Is Default' - )->addColumn( - 'visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 1, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Visible on front' - )->addForeignKey( - $installer->getFkName('sales_order_status_state', 'status', 'sales_order_status', 'status'), - 'status', - $installer->getTable('sales_order_status'), - 'status', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Order Status Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'sales_order_status_label' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sales_order_status_label') - )->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false, 'primary' => true], - 'Status' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store Id' - )->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 128, - ['nullable' => false], - 'Label' - )->addIndex( - $installer->getIdxName('sales_order_status_label', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('sales_order_status_label', 'status', 'sales_order_status', 'status'), - 'status', - $installer->getTable('sales_order_status'), - 'status', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Order Status Label Table' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $installer->startSetup(); + + /** + * Create table 'sales_order' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'State' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Status' + )->addColumn( + 'coupon_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Coupon Code' + )->addColumn( + 'protect_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Protect Code' + )->addColumn( + 'shipping_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Description' + )->addColumn( + 'is_virtual', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Virtual' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer Id' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Amount' + )->addColumn( + 'base_discount_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Canceled' + )->addColumn( + 'base_discount_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Invoiced' + )->addColumn( + 'base_discount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Refunded' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'base_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Amount' + )->addColumn( + 'base_shipping_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Canceled' + )->addColumn( + 'base_shipping_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Invoiced' + )->addColumn( + 'base_shipping_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Refunded' + )->addColumn( + 'base_shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Tax Amount' + )->addColumn( + 'base_shipping_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Tax Refunded' + )->addColumn( + 'base_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal' + )->addColumn( + 'base_subtotal_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Canceled' + )->addColumn( + 'base_subtotal_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Invoiced' + )->addColumn( + 'base_subtotal_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Refunded' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Amount' + )->addColumn( + 'base_tax_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Canceled' + )->addColumn( + 'base_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Invoiced' + )->addColumn( + 'base_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Refunded' + )->addColumn( + 'base_to_global_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Global Rate' + )->addColumn( + 'base_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Order Rate' + )->addColumn( + 'base_total_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Canceled' + )->addColumn( + 'base_total_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Invoiced' + )->addColumn( + 'base_total_invoiced_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Invoiced Cost' + )->addColumn( + 'base_total_offline_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Offline Refunded' + )->addColumn( + 'base_total_online_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Online Refunded' + )->addColumn( + 'base_total_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Paid' + )->addColumn( + 'base_total_qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Qty Ordered' + )->addColumn( + 'base_total_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Refunded' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Amount' + )->addColumn( + 'discount_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Canceled' + )->addColumn( + 'discount_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Invoiced' + )->addColumn( + 'discount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Refunded' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Amount' + )->addColumn( + 'shipping_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Canceled' + )->addColumn( + 'shipping_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Invoiced' + )->addColumn( + 'shipping_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Refunded' + )->addColumn( + 'shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Tax Amount' + )->addColumn( + 'shipping_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Tax Refunded' + )->addColumn( + 'store_to_base_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Base Rate' + )->addColumn( + 'store_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Order Rate' + )->addColumn( + 'subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal' + )->addColumn( + 'subtotal_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Canceled' + )->addColumn( + 'subtotal_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Invoiced' + )->addColumn( + 'subtotal_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Refunded' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Amount' + )->addColumn( + 'tax_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Canceled' + )->addColumn( + 'tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Invoiced' + )->addColumn( + 'tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Refunded' + )->addColumn( + 'total_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Canceled' + )->addColumn( + 'total_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Invoiced' + )->addColumn( + 'total_offline_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Offline Refunded' + )->addColumn( + 'total_online_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Online Refunded' + )->addColumn( + 'total_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Paid' + )->addColumn( + 'total_qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Qty Ordered' + )->addColumn( + 'total_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Refunded' + )->addColumn( + 'can_ship_partially', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Can Ship Partially' + )->addColumn( + 'can_ship_partially_item', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Can Ship Partially Item' + )->addColumn( + 'customer_is_guest', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Customer Is Guest' + )->addColumn( + 'customer_note_notify', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Customer Note Notify' + )->addColumn( + 'billing_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Billing Address Id' + )->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + [], + 'Customer Group Id' + )->addColumn( + 'edit_increment', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Edit Increment' + )->addColumn( + 'email_sent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Email Sent' + )->addColumn( + 'forced_shipment_with_invoice', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Forced Do Shipment With Invoice' + )->addColumn( + 'payment_auth_expiration', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Payment Authorization Expiration' + )->addColumn( + 'quote_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Quote Address Id' + )->addColumn( + 'quote_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Quote Id' + )->addColumn( + 'shipping_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipping Address Id' + )->addColumn( + 'adjustment_negative', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Adjustment Negative' + )->addColumn( + 'adjustment_positive', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Adjustment Positive' + )->addColumn( + 'base_adjustment_negative', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Adjustment Negative' + )->addColumn( + 'base_adjustment_positive', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Adjustment Positive' + )->addColumn( + 'base_shipping_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Discount Amount' + )->addColumn( + 'base_subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Incl Tax' + )->addColumn( + 'base_total_due', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Due' + )->addColumn( + 'payment_authorization_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Payment Authorization Amount' + )->addColumn( + 'shipping_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Discount Amount' + )->addColumn( + 'subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Incl Tax' + )->addColumn( + 'total_due', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Due' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Weight' + )->addColumn( + 'customer_dob', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Customer Dob' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'applied_rule_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Applied Rule Ids' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'customer_email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Email' + )->addColumn( + 'customer_firstname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Firstname' + )->addColumn( + 'customer_lastname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Lastname' + )->addColumn( + 'customer_middlename', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Middlename' + )->addColumn( + 'customer_prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Prefix' + )->addColumn( + 'customer_suffix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Suffix' + )->addColumn( + 'customer_taxvat', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Customer Taxvat' + )->addColumn( + 'discount_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Discount Description' + )->addColumn( + 'ext_customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Ext Customer Id' + )->addColumn( + 'ext_order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Ext Order Id' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Global Currency Code' + )->addColumn( + 'hold_before_state', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Hold Before State' + )->addColumn( + 'hold_before_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Hold Before Status' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Order Currency Code' + )->addColumn( + 'original_increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Original Increment Id' + )->addColumn( + 'relation_child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Relation Child Id' + )->addColumn( + 'relation_child_real_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Relation Child Real Id' + )->addColumn( + 'relation_parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Relation Parent Id' + )->addColumn( + 'relation_parent_real_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Relation Parent Real Id' + )->addColumn( + 'remote_ip', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Remote Ip' + )->addColumn( + 'shipping_method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Method' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Store Currency Code' + )->addColumn( + 'store_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Store Name' + )->addColumn( + 'x_forwarded_for', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'X Forwarded For' + )->addColumn( + 'customer_note', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Customer Note' + )->addColumn( + '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_UPDATE], + 'Updated At' + )->addColumn( + 'total_item_count', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Total Item Count' + )->addColumn( + 'customer_gender', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Customer Gender' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'shipping_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Hidden Tax Amount' + )->addColumn( + 'base_shipping_hidden_tax_amnt', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Hidden Tax Amount' + )->addColumn( + 'hidden_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Invoiced' + )->addColumn( + 'base_hidden_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Invoiced' + )->addColumn( + 'hidden_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Refunded' + )->addColumn( + 'base_hidden_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Refunded' + )->addColumn( + 'shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Incl Tax' + )->addColumn( + 'base_shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Incl Tax' + )->addColumn( + 'coupon_rule_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Coupon Sales Rule Name' + )->addIndex( + $installer->getIdxName('sales_order', ['status']), + ['status'] + )->addIndex( + $installer->getIdxName('sales_order', ['state']), + ['state'] + )->addIndex( + $installer->getIdxName('sales_order', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName( + 'sales_order', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_order', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_order', ['customer_id']), + ['customer_id'] + )->addIndex( + $installer->getIdxName('sales_order', ['ext_order_id']), + ['ext_order_id'] + )->addIndex( + $installer->getIdxName('sales_order', ['quote_id']), + ['quote_id'] + )->addIndex( + $installer->getIdxName('sales_order', ['updated_at']), + ['updated_at'] + )->addForeignKey( + $installer->getFkName('sales_order', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_order', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_grid' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_grid') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Status' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'store_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Store Name' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer Id' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'base_total_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Paid' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'total_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Paid' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Order Currency Code' + )->addColumn( + 'shipping_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Name' + )->addColumn( + 'billing_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Billing Name' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addIndex( + $installer->getIdxName('sales_order_grid', ['status']), + ['status'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['base_grand_total']), + ['base_grand_total'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['base_total_paid']), + ['base_total_paid'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['grand_total']), + ['grand_total'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['total_paid']), + ['total_paid'] + )->addIndex( + $installer->getIdxName( + 'sales_order_grid', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['shipping_name']), + ['shipping_name'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['billing_name']), + ['billing_name'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['customer_id']), + ['customer_id'] + )->addIndex( + $installer->getIdxName('sales_order_grid', ['updated_at']), + ['updated_at'] + )->addForeignKey( + $installer->getFkName('sales_order_grid', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_order_grid', 'entity_id', 'sales_order', 'entity_id'), + 'entity_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_order_grid', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order Grid' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_address' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_address') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Id' + )->addColumn( + 'customer_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Customer Address Id' + )->addColumn( + 'quote_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Quote Address Id' + )->addColumn( + 'region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Region Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Customer Id' + )->addColumn( + 'fax', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Fax' + )->addColumn( + 'region', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Region' + )->addColumn( + 'postcode', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Postcode' + )->addColumn( + 'lastname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Lastname' + )->addColumn( + 'street', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Street' + )->addColumn( + 'city', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'City' + )->addColumn( + 'email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Email' + )->addColumn( + 'telephone', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Phone Number' + )->addColumn( + 'country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + [], + 'Country Id' + )->addColumn( + 'firstname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Firstname' + )->addColumn( + 'address_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Address Type' + )->addColumn( + 'prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Prefix' + )->addColumn( + 'middlename', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Middlename' + )->addColumn( + 'suffix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Suffix' + )->addColumn( + 'company', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Company' + )->addIndex( + $installer->getIdxName('sales_order_address', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_order_address', 'parent_id', 'sales_order', 'entity_id'), + 'parent_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order Address' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_status_history' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status_history') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'is_customer_notified', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Is Customer Notified' + )->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + )->addColumn( + 'comment', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Comment' + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Status' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'entity_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true], + 'Shows what entity history is bind to.' + )->addIndex( + $installer->getIdxName('sales_order_status_history', ['parent_id']), + ['parent_id'] + )->addIndex( + $installer->getIdxName('sales_order_status_history', ['created_at']), + ['created_at'] + )->addForeignKey( + $installer->getFkName('sales_order_status_history', 'parent_id', 'sales_order', 'entity_id'), + 'parent_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order Status History' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_item') + )->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Item Id' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Order Id' + )->addColumn( + 'parent_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Item Id' + )->addColumn( + 'quote_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Quote Item Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Updated At' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'product_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Product Type' + )->addColumn( + 'product_options', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Product Options' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Weight' + )->addColumn( + 'is_virtual', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Virtual' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'applied_rule_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Applied Rule Ids' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'is_qty_decimal', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Qty Decimal' + )->addColumn( + 'no_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'No Discount' + )->addColumn( + 'qty_backordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Backordered' + )->addColumn( + 'qty_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Canceled' + )->addColumn( + 'qty_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Invoiced' + )->addColumn( + 'qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Ordered' + )->addColumn( + 'qty_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Refunded' + )->addColumn( + 'qty_shipped', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Qty Shipped' + )->addColumn( + 'base_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Cost' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + )->addColumn( + 'base_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Price' + )->addColumn( + 'original_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Original Price' + )->addColumn( + 'base_original_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Original Price' + )->addColumn( + 'tax_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Percent' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Amount' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Tax Amount' + )->addColumn( + 'tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Tax Invoiced' + )->addColumn( + 'base_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Tax Invoiced' + )->addColumn( + 'discount_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Percent' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Discount Amount' + )->addColumn( + 'discount_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Discount Invoiced' + )->addColumn( + 'base_discount_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Discount Invoiced' + )->addColumn( + 'amount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Amount Refunded' + )->addColumn( + 'base_amount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Base Amount Refunded' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Row Total' + )->addColumn( + 'base_row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Row Total' + )->addColumn( + 'row_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Row Invoiced' + )->addColumn( + 'base_row_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Base Row Invoiced' + )->addColumn( + 'row_weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['default' => '0.0000'], + 'Row Weight' + )->addColumn( + 'base_tax_before_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Before Discount' + )->addColumn( + 'tax_before_discount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Before Discount' + )->addColumn( + 'ext_order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Ext Order Item Id' + )->addColumn( + 'locked_do_invoice', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Locked Do Invoice' + )->addColumn( + 'locked_do_ship', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Locked Do Ship' + )->addColumn( + 'price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price Incl Tax' + )->addColumn( + 'base_price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price Incl Tax' + )->addColumn( + 'row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total Incl Tax' + )->addColumn( + 'base_row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total Incl Tax' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'hidden_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Invoiced' + )->addColumn( + 'base_hidden_tax_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Invoiced' + )->addColumn( + 'hidden_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Refunded' + )->addColumn( + 'base_hidden_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Refunded' + )->addColumn( + 'tax_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Canceled' + )->addColumn( + 'hidden_tax_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Canceled' + )->addColumn( + 'tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Refunded' + )->addColumn( + 'base_tax_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Refunded' + )->addColumn( + 'discount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Refunded' + )->addColumn( + 'base_discount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Refunded' + )->addIndex( + $installer->getIdxName('sales_order_item', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_order_item', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_order_item', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_order_item', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_payment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_payment') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'base_shipping_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Captured' + )->addColumn( + 'shipping_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Captured' + )->addColumn( + 'amount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount Refunded' + )->addColumn( + 'base_amount_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Paid' + )->addColumn( + 'amount_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount Canceled' + )->addColumn( + 'base_amount_authorized', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Authorized' + )->addColumn( + 'base_amount_paid_online', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Paid Online' + )->addColumn( + 'base_amount_refunded_online', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Refunded Online' + )->addColumn( + 'base_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Amount' + )->addColumn( + 'shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Amount' + )->addColumn( + 'amount_paid', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount Paid' + )->addColumn( + 'amount_authorized', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount Authorized' + )->addColumn( + 'base_amount_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Ordered' + )->addColumn( + 'base_shipping_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Refunded' + )->addColumn( + 'shipping_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Refunded' + )->addColumn( + 'base_amount_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Refunded' + )->addColumn( + 'amount_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount Ordered' + )->addColumn( + 'base_amount_canceled', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount Canceled' + )->addColumn( + 'quote_payment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Quote Payment Id' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'cc_exp_month', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Exp Month' + )->addColumn( + 'cc_ss_start_year', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Ss Start Year' + )->addColumn( + 'echeck_bank_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Echeck Bank Name' + )->addColumn( + 'method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Method' + )->addColumn( + 'cc_debug_request_body', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Debug Request Body' + )->addColumn( + 'cc_secure_verify', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Secure Verify' + )->addColumn( + 'protection_eligibility', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Protection Eligibility' + )->addColumn( + 'cc_approval', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Approval' + )->addColumn( + 'cc_last_4', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Last 4' + )->addColumn( + 'cc_status_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Status Description' + )->addColumn( + 'echeck_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Echeck Type' + )->addColumn( + 'cc_debug_response_serialized', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Debug Response Serialized' + )->addColumn( + 'cc_ss_start_month', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Ss Start Month' + )->addColumn( + 'echeck_account_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Echeck Account Type' + )->addColumn( + 'last_trans_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Last Trans Id' + )->addColumn( + 'cc_cid_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Cid Status' + )->addColumn( + 'cc_owner', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Owner' + )->addColumn( + 'cc_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Type' + )->addColumn( + 'po_number', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Po Number' + )->addColumn( + 'cc_exp_year', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Cc Exp Year' + )->addColumn( + 'cc_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Status' + )->addColumn( + 'echeck_routing_number', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Echeck Routing Number' + )->addColumn( + 'account_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Account Status' + )->addColumn( + 'anet_trans_method', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Anet Trans Method' + )->addColumn( + 'cc_debug_response_body', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Debug Response Body' + )->addColumn( + 'cc_ss_issue', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Ss Issue' + )->addColumn( + 'echeck_account_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Echeck Account Name' + )->addColumn( + 'cc_avs_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Avs Status' + )->addColumn( + 'cc_number_enc', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Number Enc' + )->addColumn( + 'cc_trans_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Cc Trans Id' + )->addColumn( + 'address_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Address Status' + )->addColumn( + 'additional_information', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Information' + )->addIndex( + $installer->getIdxName('sales_order_payment', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_order_payment', 'parent_id', 'sales_order', 'entity_id'), + 'parent_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Order Payment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'total_weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Weight' + )->addColumn( + 'total_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Qty' + )->addColumn( + 'email_sent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Email Sent' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Customer Id' + )->addColumn( + 'shipping_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipping Address Id' + )->addColumn( + 'billing_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Billing Address Id' + )->addColumn( + 'shipment_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipment Status' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addColumn( + 'packages', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '20000', + [], + 'Packed Products in Packages' + )->addColumn( + 'shipping_label', + \Magento\Framework\DB\Ddl\Table::TYPE_VARBINARY, + '2m', + [], + 'Shipping Label Content' + )->addIndex( + $installer->getIdxName('sales_shipment', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_shipment', ['total_qty']), + ['total_qty'] + )->addIndex( + $installer->getIdxName( + 'sales_shipment', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_shipment', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_shipment', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_shipment', ['updated_at']), + ['updated_at'] + )->addForeignKey( + $installer->getFkName('sales_shipment', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_shipment', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Shipment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipment_grid' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_grid') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'total_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Qty' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'shipment_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipment Status' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'order_increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'order_created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Order Created At' + )->addColumn( + 'shipping_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Name' + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['total_qty']), + ['total_qty'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['shipment_status']), + ['shipment_status'] + )->addIndex( + $installer->getIdxName( + 'sales_shipment_grid', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['order_increment_id']), + ['order_increment_id'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['order_created_at']), + ['order_created_at'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['shipping_name']), + ['shipping_name'] + )->addForeignKey( + $installer->getFkName('sales_shipment_grid', 'entity_id', 'sales_shipment', 'entity_id'), + 'entity_id', + $installer->getTable('sales_shipment'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_shipment_grid', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Shipment Grid' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipment_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_item') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Weight' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Qty' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Product Id' + )->addColumn( + 'order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Order Item Id' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addIndex( + $installer->getIdxName('sales_shipment_item', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_shipment_item', 'parent_id', 'sales_shipment', 'entity_id'), + 'parent_id', + $installer->getTable('sales_shipment'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Shipment Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipment_track' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_track') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'weight', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Weight' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Qty' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'track_number', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Number' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Title' + )->addColumn( + 'carrier_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Carrier Code' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addIndex( + $installer->getIdxName('sales_shipment_track', ['parent_id']), + ['parent_id'] + )->addIndex( + $installer->getIdxName('sales_shipment_track', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_shipment_track', ['created_at']), + ['created_at'] + )->addForeignKey( + $installer->getFkName('sales_shipment_track', 'parent_id', 'sales_shipment', 'entity_id'), + 'parent_id', + $installer->getTable('sales_shipment'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Shipment Track' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipment_comment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipment_comment') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'is_customer_notified', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Is Customer Notified' + )->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + )->addColumn( + 'comment', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Comment' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addIndex( + $installer->getIdxName('sales_shipment_comment', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_shipment_comment', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_shipment_comment', 'parent_id', 'sales_shipment', 'entity_id'), + 'parent_id', + $installer->getTable('sales_shipment'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Shipment Comment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoice' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'identity' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Tax Amount' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Amount' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Amount' + )->addColumn( + 'store_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Order Rate' + )->addColumn( + 'base_shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Tax Amount' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Amount' + )->addColumn( + 'base_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Order Rate' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Amount' + )->addColumn( + 'subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Incl Tax' + )->addColumn( + 'base_subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Incl Tax' + )->addColumn( + 'store_to_base_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Base Rate' + )->addColumn( + 'base_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Amount' + )->addColumn( + 'total_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Qty' + )->addColumn( + 'base_to_global_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Global Rate' + )->addColumn( + 'subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal' + )->addColumn( + 'base_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Amount' + )->addColumn( + 'billing_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Billing Address Id' + )->addColumn( + 'is_used_for_refund', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Used For Refund' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'email_sent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Email Sent' + )->addColumn( + 'can_void_flag', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Can Void Flag' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'State' + )->addColumn( + 'shipping_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipping Address Id' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Store Currency Code' + )->addColumn( + 'transaction_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Transaction Id' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Order Currency Code' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Global Currency Code' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'shipping_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Hidden Tax Amount' + )->addColumn( + 'base_shipping_hidden_tax_amnt', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Hidden Tax Amount' + )->addColumn( + 'shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Incl Tax' + )->addColumn( + 'base_shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Incl Tax' + )->addColumn( + 'base_total_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Total Refunded' + )->addColumn( + 'discount_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Discount Description' + )->addIndex( + $installer->getIdxName('sales_invoice', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_invoice', ['grand_total']), + ['grand_total'] + )->addIndex( + $installer->getIdxName('sales_invoice', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_invoice', ['state']), + ['state'] + )->addIndex( + $installer->getIdxName( + 'sales_invoice', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_invoice', ['created_at']), + ['created_at'] + )->addForeignKey( + $installer->getFkName('sales_invoice', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_invoice', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Invoice' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoice_grid' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice_grid') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'State' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Store Currency Code' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Order Currency Code' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Global Currency Code' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'order_increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'order_created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Order Created At' + )->addColumn( + 'billing_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Billing Name' + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['grand_total']), + ['grand_total'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['state']), + ['state'] + )->addIndex( + $installer->getIdxName( + 'sales_invoice_grid', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['order_increment_id']), + ['order_increment_id'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['order_created_at']), + ['order_created_at'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['billing_name']), + ['billing_name'] + )->addForeignKey( + $installer->getFkName('sales_invoice_grid', 'entity_id', 'sales_invoice', 'entity_id'), + 'entity_id', + $installer->getTable('sales_invoice'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_invoice_grid', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Invoice Grid' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoice_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice_item') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'base_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Amount' + )->addColumn( + 'base_row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Amount' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Amount' + )->addColumn( + 'price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price Incl Tax' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Amount' + )->addColumn( + 'base_price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price Incl Tax' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Qty' + )->addColumn( + 'base_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Cost' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + )->addColumn( + 'base_row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total Incl Tax' + )->addColumn( + 'row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total Incl Tax' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Product Id' + )->addColumn( + 'order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Order Item Id' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'tax_ratio', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 512, + [], + 'Ratio of tax invoiced over tax of the order item' + )->addIndex( + $installer->getIdxName('sales_invoice_item', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_invoice_item', 'parent_id', 'sales_invoice', 'entity_id'), + 'parent_id', + $installer->getTable('sales_invoice'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Invoice Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoice_comment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoice_comment') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'is_customer_notified', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Customer Notified' + )->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + )->addColumn( + 'comment', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Comment' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addIndex( + $installer->getIdxName('sales_invoice_comment', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_invoice_comment', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_invoice_comment', 'parent_id', 'sales_invoice', 'entity_id'), + 'parent_id', + $installer->getTable('sales_invoice'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Invoice Comment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_creditmemo' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'adjustment_positive', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Adjustment Positive' + )->addColumn( + 'base_shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Tax Amount' + )->addColumn( + 'store_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Order Rate' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Amount' + )->addColumn( + 'base_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Order Rate' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'base_adjustment_negative', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Adjustment Negative' + )->addColumn( + 'base_subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal Incl Tax' + )->addColumn( + 'shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Amount' + )->addColumn( + 'subtotal_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal Incl Tax' + )->addColumn( + 'adjustment_negative', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Adjustment Negative' + )->addColumn( + 'base_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Amount' + )->addColumn( + 'store_to_base_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Base Rate' + )->addColumn( + 'base_to_global_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Global Rate' + )->addColumn( + 'base_adjustment', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Adjustment' + )->addColumn( + 'base_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Subtotal' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Amount' + )->addColumn( + 'subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Subtotal' + )->addColumn( + 'adjustment', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Adjustment' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'base_adjustment_positive', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Adjustment Positive' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Amount' + )->addColumn( + 'shipping_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Tax Amount' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Amount' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'email_sent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Email Sent' + )->addColumn( + 'creditmemo_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Creditmemo Status' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'State' + )->addColumn( + 'shipping_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Shipping Address Id' + )->addColumn( + 'billing_address_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Billing Address Id' + )->addColumn( + 'invoice_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Invoice Id' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Store Currency Code' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Order Currency Code' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Global Currency Code' + )->addColumn( + 'transaction_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Transaction Id' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'shipping_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Hidden Tax Amount' + )->addColumn( + 'base_shipping_hidden_tax_amnt', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Hidden Tax Amount' + )->addColumn( + 'shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Shipping Incl Tax' + )->addColumn( + 'base_shipping_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Shipping Incl Tax' + )->addColumn( + 'discount_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Discount Description' + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['creditmemo_status']), + ['creditmemo_status'] + )->addIndex( + $installer->getIdxName( + 'sales_creditmemo', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['state']), + ['state'] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['created_at']), + ['created_at'] + )->addForeignKey( + $installer->getFkName('sales_creditmemo', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_creditmemo', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Creditmemo' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_creditmemo_grid' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo_grid') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'store_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Order Rate' + )->addColumn( + 'base_to_order_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Order Rate' + )->addColumn( + 'grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Grand Total' + )->addColumn( + 'store_to_base_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Store To Base Rate' + )->addColumn( + 'base_to_global_rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base To Global Rate' + )->addColumn( + 'base_grand_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Grand Total' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'creditmemo_status', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Creditmemo Status' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'State' + )->addColumn( + 'invoice_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Invoice Id' + )->addColumn( + 'store_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Store Currency Code' + )->addColumn( + 'order_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Order Currency Code' + )->addColumn( + 'base_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Base Currency Code' + )->addColumn( + 'global_currency_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 3, + [], + 'Global Currency Code' + )->addColumn( + 'increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Increment Id' + )->addColumn( + 'order_increment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Increment Id' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addColumn( + 'order_created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Order Created At' + )->addColumn( + 'billing_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Billing Name' + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['grand_total']), + ['grand_total'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['base_grand_total']), + ['base_grand_total'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['order_id']), + ['order_id'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['creditmemo_status']), + ['creditmemo_status'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['state']), + ['state'] + )->addIndex( + $installer->getIdxName( + 'sales_creditmemo_grid', + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['order_increment_id']), + ['order_increment_id'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['order_created_at']), + ['order_created_at'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['billing_name']), + ['billing_name'] + )->addForeignKey( + $installer->getFkName('sales_creditmemo_grid', 'entity_id', 'sales_creditmemo', 'entity_id'), + 'entity_id', + $installer->getTable('sales_creditmemo'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_creditmemo_grid', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Creditmemo Grid' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_creditmemo_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo_item') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'base_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price' + )->addColumn( + 'tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tax Amount' + )->addColumn( + 'base_row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Discount Amount' + )->addColumn( + 'row_total', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total' + )->addColumn( + 'base_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Discount Amount' + )->addColumn( + 'price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price Incl Tax' + )->addColumn( + 'base_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tax Amount' + )->addColumn( + 'base_price_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Price Incl Tax' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Qty' + )->addColumn( + 'base_cost', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Cost' + )->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + )->addColumn( + 'base_row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Row Total Incl Tax' + )->addColumn( + 'row_total_incl_tax', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Row Total Incl Tax' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Product Id' + )->addColumn( + 'order_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Order Item Id' + )->addColumn( + 'additional_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Additional Data' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sku' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Hidden Tax Amount' + )->addColumn( + 'base_hidden_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Hidden Tax Amount' + )->addColumn( + 'tax_ratio', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 512, + [], + 'Ratio of tax in the creditmemo item over tax of the order item' + )->addIndex( + $installer->getIdxName('sales_creditmemo_item', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_creditmemo_item', 'parent_id', 'sales_creditmemo', 'entity_id'), + 'parent_id', + $installer->getTable('sales_creditmemo'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Creditmemo Item' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_creditmemo_comment' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_creditmemo_comment') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Parent Id' + )->addColumn( + 'is_customer_notified', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Is Customer Notified' + )->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + )->addColumn( + 'comment', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Comment' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addIndex( + $installer->getIdxName('sales_creditmemo_comment', ['created_at']), + ['created_at'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_comment', ['parent_id']), + ['parent_id'] + )->addForeignKey( + $installer->getFkName('sales_creditmemo_comment', 'parent_id', 'sales_creditmemo', 'entity_id'), + 'parent_id', + $installer->getTable('sales_creditmemo'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Flat Creditmemo Comment' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoiced_aggregated' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoiced_aggregated') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'orders_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Orders Invoiced' + )->addColumn( + 'invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced' + )->addColumn( + 'invoiced_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced Captured' + )->addColumn( + 'invoiced_not_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced Not Captured' + )->addIndex( + $installer->getIdxName( + 'sales_invoiced_aggregated', + ['period', 'store_id', 'order_status'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_invoiced_aggregated', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Invoiced Aggregated' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_invoiced_aggregated_order' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_invoiced_aggregated_order') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false, 'default' => false], + 'Order Status' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'orders_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Orders Invoiced' + )->addColumn( + 'invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced' + )->addColumn( + 'invoiced_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced Captured' + )->addColumn( + 'invoiced_not_captured', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Invoiced Not Captured' + )->addIndex( + $installer->getIdxName( + 'sales_invoiced_aggregated_order', + ['period', 'store_id', 'order_status'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_invoiced_aggregated_order', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Invoiced Aggregated Order' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_aggregated_created' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_aggregated_created') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false, 'default' => false], + 'Order Status' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'total_qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Qty Ordered' + )->addColumn( + 'total_qty_invoiced', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Qty Invoiced' + )->addColumn( + 'total_income_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Income Amount' + )->addColumn( + 'total_revenue_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Revenue Amount' + )->addColumn( + 'total_profit_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Profit Amount' + )->addColumn( + 'total_invoiced_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Invoiced Amount' + )->addColumn( + 'total_canceled_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Canceled Amount' + )->addColumn( + 'total_paid_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Paid Amount' + )->addColumn( + 'total_refunded_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Refunded Amount' + )->addColumn( + 'total_tax_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Tax Amount' + )->addColumn( + 'total_tax_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Tax Amount Actual' + )->addColumn( + 'total_shipping_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Shipping Amount' + )->addColumn( + 'total_shipping_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Shipping Amount Actual' + )->addColumn( + 'total_discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Discount Amount' + )->addColumn( + 'total_discount_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Total Discount Amount Actual' + )->addIndex( + $installer->getIdxName( + 'sales_order_aggregated_created', + ['period', 'store_id', 'order_status'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_order_aggregated_created', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Order Aggregated Created' + ); + $installer->getConnection()->createTable($table); + + $installer->getConnection()->createTable( + $installer->getConnection()->createTableByDdl( + $installer->getTable('sales_order_aggregated_created'), + $installer->getTable('sales_order_aggregated_updated') + ) + ); + + /** + * Create table 'sales_payment_transaction' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_payment_transaction') + )->addColumn( + 'transaction_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Transaction Id' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Parent Id' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Order Id' + )->addColumn( + 'payment_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Payment Id' + )->addColumn( + 'txn_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + [], + 'Txn Id' + )->addColumn( + 'parent_txn_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + [], + 'Parent Txn Id' + )->addColumn( + 'txn_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 15, + [], + 'Txn Type' + )->addColumn( + 'is_closed', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Closed' + )->addColumn( + 'additional_information', + \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, + '64K', + [], + 'Additional Information' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Created At' + )->addIndex( + $installer->getIdxName( + 'sales_payment_transaction', + ['order_id', 'payment_id', 'txn_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['order_id', 'payment_id', 'txn_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_payment_transaction', ['parent_id']), + ['parent_id'] + )->addIndex( + $installer->getIdxName('sales_payment_transaction', ['payment_id']), + ['payment_id'] + )->addForeignKey( + $installer->getFkName('sales_payment_transaction', 'order_id', 'sales_order', 'entity_id'), + 'order_id', + $installer->getTable('sales_order'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_payment_transaction', + 'parent_id', + 'sales_payment_transaction', + 'transaction_id' + ), + 'parent_id', + $installer->getTable('sales_payment_transaction'), + 'transaction_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_payment_transaction', 'payment_id', 'sales_order_payment', 'entity_id'), + 'payment_id', + $installer->getTable('sales_order_payment'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Payment Transaction' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_refunded_aggregated' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_refunded_aggregated') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false, 'default' => false], + 'Order Status' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Refunded' + )->addColumn( + 'online_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Online Refunded' + )->addColumn( + 'offline_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Offline Refunded' + )->addIndex( + $installer->getIdxName( + 'sales_refunded_aggregated', + ['period', 'store_id', 'order_status'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_refunded_aggregated', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Refunded Aggregated' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_refunded_aggregated_order' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_refunded_aggregated_order') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Refunded' + )->addColumn( + 'online_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Online Refunded' + )->addColumn( + 'offline_refunded', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Offline Refunded' + )->addIndex( + $installer->getIdxName( + 'sales_refunded_aggregated_order', + ['period', 'store_id', 'order_status'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_refunded_aggregated_order', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Refunded Aggregated Order' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipping_aggregated' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipping_aggregated') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'shipping_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Description' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'total_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Shipping' + )->addColumn( + 'total_shipping_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Shipping Actual' + )->addIndex( + $installer->getIdxName( + 'sales_shipping_aggregated', + ['period', 'store_id', 'order_status', 'shipping_description'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status', 'shipping_description'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_shipping_aggregated', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Shipping Aggregated' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_shipping_aggregated_order' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_shipping_aggregated_order') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'shipping_description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Shipping Description' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'total_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Shipping' + )->addColumn( + 'total_shipping_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Total Shipping Actual' + )->addIndex( + $installer->getIdxName( + 'sales_shipping_aggregated_order', + ['period', 'store_id', 'order_status', 'shipping_description'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status', 'shipping_description'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_shipping_aggregated_order', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Shipping Aggregated Order' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_bestsellers_aggregated_daily' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_bestsellers_aggregated_daily') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + )->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + )->addColumn( + 'qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty Ordered' + )->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + )->addIndex( + $installer->getIdxName( + 'sales_bestsellers_aggregated_daily', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_daily', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_daily', ['product_id']), + ['product_id'] + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_daily', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Bestsellers Aggregated Daily' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_bestsellers_aggregated_monthly' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_bestsellers_aggregated_monthly') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + )->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + )->addColumn( + 'qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty Ordered' + )->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + )->addIndex( + $installer->getIdxName( + 'sales_bestsellers_aggregated_monthly', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_monthly', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_monthly', ['product_id']), + ['product_id'] + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_monthly', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Bestsellers Aggregated Monthly' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_bestsellers_aggregated_yearly' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_bestsellers_aggregated_yearly') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Product Id' + )->addColumn( + 'product_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Product Name' + )->addColumn( + 'product_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Product Price' + )->addColumn( + 'qty_ordered', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Qty Ordered' + )->addColumn( + 'rating_pos', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rating Pos' + )->addIndex( + $installer->getIdxName( + 'sales_bestsellers_aggregated_yearly', + ['period', 'store_id', 'product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_yearly', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('sales_bestsellers_aggregated_yearly', ['product_id']), + ['product_id'] + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_bestsellers_aggregated_yearly', + 'product_id', + 'catalog_product_entity', + 'entity_id' + ), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Bestsellers Aggregated Yearly' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_tax' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_tax') + )->addColumn( + 'tax_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Tax Id' + )->addColumn( + 'order_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Order Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Code' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Title' + )->addColumn( + 'percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Percent' + )->addColumn( + 'amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Amount' + )->addColumn( + 'priority', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Priority' + )->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Position' + )->addColumn( + 'base_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Amount' + )->addColumn( + 'process', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false], + 'Process' + )->addColumn( + 'base_real_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Real Amount' + )->addColumn( + 'hidden', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Hidden' + )->addIndex( + $installer->getIdxName('sales_order_tax', ['order_id', 'priority', 'position']), + ['order_id', 'priority', 'position'] + )->setComment( + 'Sales Order Tax Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_status' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status') + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Status' + )->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 128, + ['nullable' => false], + 'Label' + )->setComment( + 'Sales Order Status Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_status_state' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status_state') + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Status' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Label' + )->addColumn( + 'is_default', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Default' + )->addColumn( + 'visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + 1, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Visible on front' + )->addForeignKey( + $installer->getFkName('sales_order_status_state', 'status', 'sales_order_status', 'status'), + 'status', + $installer->getTable('sales_order_status'), + 'status', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Order Status Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_order_status_label' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_order_status_label') + )->addColumn( + 'status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => true], + 'Status' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store Id' + )->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 128, + ['nullable' => false], + 'Label' + )->addIndex( + $installer->getIdxName('sales_order_status_label', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sales_order_status_label', 'status', 'sales_order_status', 'status'), + 'status', + $installer->getTable('sales_order_status'), + 'status', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Order Status Label Table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php index d32e0885d44e3..d9aaa6805cf49 100644 --- a/app/code/Magento/Sales/Setup/UpgradeSchema.php +++ b/app/code/Magento/Sales/Setup/UpgradeSchema.php @@ -1,11 +1,8 @@ getVersion(), '2.0.1') <= 0) { $installer = $setup; @@ -59,5 +56,5 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con } } } - } + } } \ No newline at end of file diff --git a/app/code/Magento/SalesRule/Setup/InstallSchema.php b/app/code/Magento/SalesRule/Setup/InstallSchema.php index 1562022f4a4da..3a5ab1eab990c 100644 --- a/app/code/Magento/SalesRule/Setup/InstallSchema.php +++ b/app/code/Magento/SalesRule/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'salesrule' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('salesrule') - )->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' - )->addColumn( - 'name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Name' - )->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Description' - )->addColumn( - 'from_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => true, 'default' => null], - 'From Date' - )->addColumn( - 'to_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => true, 'default' => null], - 'To Date' - )->addColumn( - 'uses_per_customer', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Uses Per Customer' - )->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Is Active' - )->addColumn( - 'conditions_serialized', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Conditions Serialized' - )->addColumn( - 'actions_serialized', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '2M', - [], - 'Actions Serialized' - )->addColumn( - 'stop_rules_processing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Stop Rules Processing' - )->addColumn( - 'is_advanced', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Is Advanced' - )->addColumn( - 'product_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Product Ids' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - )->addColumn( - 'simple_action', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Simple Action' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount' - )->addColumn( - 'discount_qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - [], - 'Discount Qty' - )->addColumn( - 'discount_step', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Discount Step' - )->addColumn( - 'apply_to_shipping', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Apply To Shipping' - )->addColumn( - 'times_used', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Times Used' - )->addColumn( - 'is_rss', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Is Rss' - )->addColumn( - 'coupon_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '1'], - 'Coupon Type' - )->addColumn( - 'use_auto_generation', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => false, 'nullable' => false, 'default' => 0], - 'Use Auto Generation' - )->addColumn( - 'uses_per_coupon', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => 0], - 'User Per Coupon' - )->addIndex( - $installer->getIdxName('salesrule', ['is_active', 'sort_order', 'to_date', 'from_date']), - ['is_active', 'sort_order', 'to_date', 'from_date'] - )->setComment( - 'Salesrule' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'salesrule_coupon' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_coupon') - )->addColumn( - 'coupon_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Coupon Id' - )->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Rule Id' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Code' - )->addColumn( - 'usage_limit', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Usage Limit' - )->addColumn( - 'usage_per_customer', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Usage Per Customer' - )->addColumn( - 'times_used', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Times Used' - )->addColumn( - 'expiration_date', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Expiration Date' - )->addColumn( - 'is_primary', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Is Primary' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Coupon Code Creation Date' - )->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => true, 'default' => 0], - 'Coupon Code Type' - )->addIndex( - $installer->getIdxName( - 'salesrule_coupon', - ['code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName( - 'salesrule_coupon', - ['rule_id', 'is_primary'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['rule_id', 'is_primary'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('salesrule_coupon', ['rule_id']), - ['rule_id'] - )->addForeignKey( - $installer->getFkName('salesrule_coupon', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Salesrule Coupon' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'salesrule_coupon_usage' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_coupon_usage') - )->addColumn( - 'coupon_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Coupon Id' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Id' - )->addColumn( - 'times_used', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Times Used' - )->addIndex( - $installer->getIdxName('salesrule_coupon_usage', ['customer_id']), - ['customer_id'] - )->addForeignKey( - $installer->getFkName('salesrule_coupon_usage', 'coupon_id', 'salesrule_coupon', 'coupon_id'), - 'coupon_id', - $installer->getTable('salesrule_coupon'), - 'coupon_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Salesrule Coupon Usage' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'salesrule_customer' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_customer') - )->addColumn( - 'rule_customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Customer Id' - )->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Rule Id' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer Id' - )->addColumn( - 'times_used', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Times Used' - )->addIndex( - $installer->getIdxName('salesrule_customer', ['rule_id', 'customer_id']), - ['rule_id', 'customer_id'] - )->addIndex( - $installer->getIdxName('salesrule_customer', ['customer_id', 'rule_id']), - ['customer_id', 'rule_id'] - )->addForeignKey( - $installer->getFkName('salesrule_customer', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Salesrule Customer' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'salesrule_label' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_label') - )->addColumn( - 'label_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Label Id' - )->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Rule Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' - )->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Label' - )->addIndex( - $installer->getIdxName( - 'salesrule_label', - ['rule_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['rule_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('salesrule_label', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('salesrule_label', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('salesrule_label', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Salesrule Label' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'salesrule_product_attribute' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_product_attribute') - )->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' - )->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - )->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - )->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Attribute Id' - )->addIndex( - $installer->getIdxName('salesrule_product_attribute', ['website_id']), - ['website_id'] - )->addIndex( - $installer->getIdxName('salesrule_product_attribute', ['customer_group_id']), - ['customer_group_id'] - )->addIndex( - $installer->getIdxName('salesrule_product_attribute', ['attribute_id']), - ['attribute_id'] - )->addForeignKey( - $installer->getFkName('salesrule_product_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION - )->addForeignKey( - $installer->getFkName('salesrule_product_attribute', 'customer_group_id', 'customer_group', 'customer_group_id'), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION - )->addForeignKey( - $installer->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION - )->addForeignKey( - $installer->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION - )->setComment( - 'Salesrule Product Attribute' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'salesrule_coupon_aggregated' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_coupon_aggregated') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => false], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' - )->addColumn( - 'coupon_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Coupon Code' - )->addColumn( - 'coupon_uses', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Coupon Uses' - )->addColumn( - 'subtotal_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Subtotal Amount' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount' - )->addColumn( - 'total_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Total Amount' - )->addColumn( - 'subtotal_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Subtotal Amount Actual' - )->addColumn( - 'discount_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount Actual' - )->addColumn( - 'total_amount_actual', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Total Amount Actual' - )->addColumn( - 'rule_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Rule Name' - )->addIndex( - $installer->getIdxName( - 'salesrule_coupon_aggregated', - ['period', 'store_id', 'order_status', 'coupon_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status', 'coupon_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('salesrule_coupon_aggregated', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('salesrule_coupon_aggregated', ['rule_name']), - ['rule_name'] - )->addForeignKey( - $installer->getFkName('salesrule_coupon_aggregated', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Coupon Aggregated' - ); - $installer->getConnection()->createTable($table); - - $installer->getConnection()->createTable( - $installer->getConnection()->createTableByDdl( - $installer->getTable('salesrule_coupon_aggregated'), - $installer->getTable('salesrule_coupon_aggregated_updated') - ) - ); - - /** - * Create table 'salesrule_coupon_aggregated_order' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('salesrule_coupon_aggregated_order') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => false], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Order Status' - )->addColumn( - 'coupon_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - [], - 'Coupon Code' - )->addColumn( - 'coupon_uses', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'default' => '0'], - 'Coupon Uses' - )->addColumn( - 'subtotal_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Subtotal Amount' - )->addColumn( - 'discount_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Discount Amount' - )->addColumn( - 'total_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - [12, 4], - ['nullable' => false, 'default' => '0.0000'], - 'Total Amount' - )->addColumn( - 'rule_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Rule Name' - )->addIndex( - $installer->getIdxName( - 'salesrule_coupon_aggregated_order', - ['period', 'store_id', 'order_status', 'coupon_code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['period', 'store_id', 'order_status', 'coupon_code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('salesrule_coupon_aggregated_order', ['store_id']), - ['store_id'] - )->addIndex( - $installer->getIdxName('salesrule_coupon_aggregated_order', ['rule_name']), - ['rule_name'] - )->addForeignKey( - $installer->getFkName('salesrule_coupon_aggregated_order', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Coupon Aggregated Order' - ); - $installer->getConnection()->createTable($table); - - $websitesTable = $installer->getTable('store_website'); - $customerGroupsTable = $installer->getTable('customer_group'); - $rulesWebsitesTable = $installer->getTable('salesrule_website'); - $rulesCustomerGroupsTable = $installer->getTable('salesrule_customer_group'); - - /** - * Create table 'salesrule_website' if not exists. This table will be used instead of - * column website_ids of main catalog rules table - */ - $table = $installer->getConnection()->newTable( - $rulesWebsitesTable - )->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' - )->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - )->addIndex( - $installer->getIdxName('salesrule_website', ['website_id']), - ['website_id'] - )->addForeignKey( - $installer->getFkName('salesrule_website', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'), - 'website_id', - $websitesTable, - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Rules To Websites Relations' - ); - - $installer->getConnection()->createTable($table); - - /** - * Create table 'salesrule_customer_group' if not exists. This table will be used instead of - * column customer_group_ids of main catalog rules table - */ - $table = $installer->getConnection()->newTable( - $rulesCustomerGroupsTable - )->addColumn( - 'rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rule Id' - )->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'primary' => true], - 'Customer Group Id' - )->addIndex( - $installer->getIdxName('salesrule_customer_group', ['customer_group_id']), - ['customer_group_id'] - )->addForeignKey( - $installer->getFkName('salesrule_customer_group', 'rule_id', 'salesrule', 'rule_id'), - 'rule_id', - $installer->getTable('salesrule'), - 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('salesrule_customer_group', 'customer_group_id', 'customer_group', 'customer_group_id'), - 'customer_group_id', - $customerGroupsTable, - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Rules To Customer Groups Relations' - ); - - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $installer->startSetup(); + + /** + * Create table 'salesrule' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule') + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + )->addColumn( + 'name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Name' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Description' + )->addColumn( + 'from_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => true, 'default' => null], + 'From Date' + )->addColumn( + 'to_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => true, 'default' => null], + 'To Date' + )->addColumn( + 'uses_per_customer', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Uses Per Customer' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Is Active' + )->addColumn( + 'conditions_serialized', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Conditions Serialized' + )->addColumn( + 'actions_serialized', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '2M', + [], + 'Actions Serialized' + )->addColumn( + 'stop_rules_processing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Stop Rules Processing' + )->addColumn( + 'is_advanced', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Advanced' + )->addColumn( + 'product_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Product Ids' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + )->addColumn( + 'simple_action', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Simple Action' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'discount_qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + [], + 'Discount Qty' + )->addColumn( + 'discount_step', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Discount Step' + )->addColumn( + 'apply_to_shipping', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Apply To Shipping' + )->addColumn( + 'times_used', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Times Used' + )->addColumn( + 'is_rss', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Is Rss' + )->addColumn( + 'coupon_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Coupon Type' + )->addColumn( + 'use_auto_generation', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => false, 'nullable' => false, 'default' => 0], + 'Use Auto Generation' + )->addColumn( + 'uses_per_coupon', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => 0], + 'User Per Coupon' + )->addIndex( + $installer->getIdxName('salesrule', ['is_active', 'sort_order', 'to_date', 'from_date']), + ['is_active', 'sort_order', 'to_date', 'from_date'] + )->setComment( + 'Salesrule' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_coupon' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon') + )->addColumn( + 'coupon_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Coupon Id' + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Rule Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Code' + )->addColumn( + 'usage_limit', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Usage Limit' + )->addColumn( + 'usage_per_customer', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Usage Per Customer' + )->addColumn( + 'times_used', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Times Used' + )->addColumn( + 'expiration_date', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Expiration Date' + )->addColumn( + 'is_primary', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Is Primary' + )->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Coupon Code Creation Date' + )->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => true, 'default' => 0], + 'Coupon Code Type' + )->addIndex( + $installer->getIdxName( + 'salesrule_coupon', + ['code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName( + 'salesrule_coupon', + ['rule_id', 'is_primary'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['rule_id', 'is_primary'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('salesrule_coupon', ['rule_id']), + ['rule_id'] + )->addForeignKey( + $installer->getFkName('salesrule_coupon', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Salesrule Coupon' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_coupon_usage' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon_usage') + )->addColumn( + 'coupon_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Coupon Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Id' + )->addColumn( + 'times_used', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Times Used' + )->addIndex( + $installer->getIdxName('salesrule_coupon_usage', ['customer_id']), + ['customer_id'] + )->addForeignKey( + $installer->getFkName('salesrule_coupon_usage', 'coupon_id', 'salesrule_coupon', 'coupon_id'), + 'coupon_id', + $installer->getTable('salesrule_coupon'), + 'coupon_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Salesrule Coupon Usage' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_customer' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_customer') + )->addColumn( + 'rule_customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Customer Id' + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Rule Id' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Id' + )->addColumn( + 'times_used', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Times Used' + )->addIndex( + $installer->getIdxName('salesrule_customer', ['rule_id', 'customer_id']), + ['rule_id', 'customer_id'] + )->addIndex( + $installer->getIdxName('salesrule_customer', ['customer_id', 'rule_id']), + ['customer_id', 'rule_id'] + )->addForeignKey( + $installer->getFkName('salesrule_customer', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Salesrule Customer' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_label' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_label') + )->addColumn( + 'label_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Label Id' + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Rule Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + )->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Label' + )->addIndex( + $installer->getIdxName( + 'salesrule_label', + ['rule_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['rule_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('salesrule_label', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('salesrule_label', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('salesrule_label', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Salesrule Label' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_product_attribute' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_product_attribute') + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + )->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute Id' + )->addIndex( + $installer->getIdxName('salesrule_product_attribute', ['website_id']), + ['website_id'] + )->addIndex( + $installer->getIdxName('salesrule_product_attribute', ['customer_group_id']), + ['customer_group_id'] + )->addIndex( + $installer->getIdxName('salesrule_product_attribute', ['attribute_id']), + ['attribute_id'] + )->addForeignKey( + $installer->getFkName('salesrule_product_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + )->addForeignKey( + $installer->getFkName('salesrule_product_attribute', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + )->addForeignKey( + $installer->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + )->addForeignKey( + $installer->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + )->setComment( + 'Salesrule Product Attribute' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_coupon_aggregated' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon_aggregated') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => false], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'coupon_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Coupon Code' + )->addColumn( + 'coupon_uses', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Coupon Uses' + )->addColumn( + 'subtotal_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Subtotal Amount' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'total_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Total Amount' + )->addColumn( + 'subtotal_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Subtotal Amount Actual' + )->addColumn( + 'discount_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount Actual' + )->addColumn( + 'total_amount_actual', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Total Amount Actual' + )->addColumn( + 'rule_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Rule Name' + )->addIndex( + $installer->getIdxName( + 'salesrule_coupon_aggregated', + ['period', 'store_id', 'order_status', 'coupon_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status', 'coupon_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('salesrule_coupon_aggregated', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('salesrule_coupon_aggregated', ['rule_name']), + ['rule_name'] + )->addForeignKey( + $installer->getFkName('salesrule_coupon_aggregated', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Coupon Aggregated' + ); + $installer->getConnection()->createTable($table); + + $installer->getConnection()->createTable( + $installer->getConnection()->createTableByDdl( + $installer->getTable('salesrule_coupon_aggregated'), + $installer->getTable('salesrule_coupon_aggregated_updated') + ) + ); + + /** + * Create table 'salesrule_coupon_aggregated_order' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('salesrule_coupon_aggregated_order') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => false], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Order Status' + )->addColumn( + 'coupon_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'Coupon Code' + )->addColumn( + 'coupon_uses', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Coupon Uses' + )->addColumn( + 'subtotal_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Subtotal Amount' + )->addColumn( + 'discount_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Discount Amount' + )->addColumn( + 'total_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + [12, 4], + ['nullable' => false, 'default' => '0.0000'], + 'Total Amount' + )->addColumn( + 'rule_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Rule Name' + )->addIndex( + $installer->getIdxName( + 'salesrule_coupon_aggregated_order', + ['period', 'store_id', 'order_status', 'coupon_code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['period', 'store_id', 'order_status', 'coupon_code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('salesrule_coupon_aggregated_order', ['store_id']), + ['store_id'] + )->addIndex( + $installer->getIdxName('salesrule_coupon_aggregated_order', ['rule_name']), + ['rule_name'] + )->addForeignKey( + $installer->getFkName('salesrule_coupon_aggregated_order', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Coupon Aggregated Order' + ); + $installer->getConnection()->createTable($table); + + $websitesTable = $installer->getTable('store_website'); + $customerGroupsTable = $installer->getTable('customer_group'); + $rulesWebsitesTable = $installer->getTable('salesrule_website'); + $rulesCustomerGroupsTable = $installer->getTable('salesrule_customer_group'); + + /** + * Create table 'salesrule_website' if not exists. This table will be used instead of + * column website_ids of main catalog rules table + */ + $table = $installer->getConnection()->newTable( + $rulesWebsitesTable + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + )->addIndex( + $installer->getIdxName('salesrule_website', ['website_id']), + ['website_id'] + )->addForeignKey( + $installer->getFkName('salesrule_website', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'), + 'website_id', + $websitesTable, + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Rules To Websites Relations' + ); + + $installer->getConnection()->createTable($table); + + /** + * Create table 'salesrule_customer_group' if not exists. This table will be used instead of + * column customer_group_ids of main catalog rules table + */ + $table = $installer->getConnection()->newTable( + $rulesCustomerGroupsTable + )->addColumn( + 'rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rule Id' + )->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group Id' + )->addIndex( + $installer->getIdxName('salesrule_customer_group', ['customer_group_id']), + ['customer_group_id'] + )->addForeignKey( + $installer->getFkName('salesrule_customer_group', 'rule_id', 'salesrule', 'rule_id'), + 'rule_id', + $installer->getTable('salesrule'), + 'rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('salesrule_customer_group', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $customerGroupsTable, + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Rules To Customer Groups Relations' + ); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Search/Setup/InstallSchema.php b/app/code/Magento/Search/Setup/InstallSchema.php index f2d08988a4c73..037355ddc12de 100644 --- a/app/code/Magento/Search/Setup/InstallSchema.php +++ b/app/code/Magento/Search/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'search_query' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('search_query')) - ->addColumn( - 'query_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Query ID' - ) - ->addColumn( - 'query_text', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Query text' - ) - ->addColumn( - 'num_results', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Num results' - ) - ->addColumn( - 'popularity', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Popularity' - ) - ->addColumn( - 'redirect', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Redirect' - ) - ->addColumn( - 'synonym_for', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Synonym for' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store ID' - ) - ->addColumn( - 'display_in_terms', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'Display in terms' - ) - ->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['default' => '1'], - 'Active status' - ) - ->addColumn( - 'is_processed', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['default' => '0'], - 'Processed status' - ) - ->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false], - 'Updated at' - ) - ->addIndex( - $installer->getIdxName('search_query', ['query_text', 'store_id', 'popularity']), - ['query_text', 'store_id', 'popularity'] - ) - ->addIndex( - $installer->getIdxName('search_query', 'store_id'), - 'store_id' - ) - ->addIndex( - $installer->getIdxName('search_query', 'synonym_for'), - 'synonym_for' - ) - ->addForeignKey( - $installer->getFkName('search_query', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) - ->setComment('Search query table'); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'search_query' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('search_query')) + ->addColumn( + 'query_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Query ID' + ) + ->addColumn( + 'query_text', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Query text' + ) + ->addColumn( + 'num_results', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Num results' + ) + ->addColumn( + 'popularity', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Popularity' + ) + ->addColumn( + 'redirect', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Redirect' + ) + ->addColumn( + 'synonym_for', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Synonym for' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'display_in_terms', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Display in terms' + ) + ->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['default' => '1'], + 'Active status' + ) + ->addColumn( + 'is_processed', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['default' => '0'], + 'Processed status' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false], + 'Updated at' + ) + ->addIndex( + $installer->getIdxName('search_query', ['query_text', 'store_id', 'popularity']), + ['query_text', 'store_id', 'popularity'] + ) + ->addIndex( + $installer->getIdxName('search_query', 'store_id'), + 'store_id' + ) + ->addIndex( + $installer->getIdxName('search_query', 'synonym_for'), + 'synonym_for' + ) + ->addForeignKey( + $installer->getFkName('search_query', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Search query table'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Sendfriend/Setup/InstallSchema.php b/app/code/Magento/Sendfriend/Setup/InstallSchema.php index 2b909e2b7d03c..c8a68c2f9fbe1 100644 --- a/app/code/Magento/Sendfriend/Setup/InstallSchema.php +++ b/app/code/Magento/Sendfriend/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - $table = $installer->getConnection()->newTable( - $installer->getTable('sendfriend_log') - )->addColumn( - 'log_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Log ID' - )->addColumn( - 'ip', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - '20', - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer IP address' - )->addColumn( - 'time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Log time' - )->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website ID' - )->addIndex( - $installer->getIdxName('sendfriend_log', 'ip'), - 'ip' - )->addIndex( - $installer->getIdxName('sendfriend_log', 'time'), - 'time' - )->setComment( - 'Send to friend function log storage table' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + $table = $installer->getConnection()->newTable( + $installer->getTable('sendfriend_log') + )->addColumn( + 'log_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Log ID' + )->addColumn( + 'ip', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + '20', + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer IP address' + )->addColumn( + 'time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Log time' + )->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website ID' + )->addIndex( + $installer->getIdxName('sendfriend_log', 'ip'), + 'ip' + )->addIndex( + $installer->getIdxName('sendfriend_log', 'time'), + 'time' + )->setComment( + 'Send to friend function log storage table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Setup/InstallSchema.php b/app/code/Magento/Sitemap/Setup/InstallSchema.php index fc55374e129bb..008539ac1f52d 100644 --- a/app/code/Magento/Sitemap/Setup/InstallSchema.php +++ b/app/code/Magento/Sitemap/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'sitemap' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('sitemap') - )->addColumn( - 'sitemap_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Sitemap Id' - )->addColumn( - 'sitemap_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Sitemap Type' - )->addColumn( - 'sitemap_filename', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Sitemap Filename' - )->addColumn( - 'sitemap_path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Sitemap Path' - )->addColumn( - 'sitemap_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Sitemap Time' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store id' - )->addIndex( - $installer->getIdxName('sitemap', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('sitemap', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'XML Sitemap' - ); - - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'sitemap' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sitemap') + )->addColumn( + 'sitemap_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Sitemap Id' + )->addColumn( + 'sitemap_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Sitemap Type' + )->addColumn( + 'sitemap_filename', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Sitemap Filename' + )->addColumn( + 'sitemap_path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Sitemap Path' + )->addColumn( + 'sitemap_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true], + 'Sitemap Time' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store id' + )->addIndex( + $installer->getIdxName('sitemap', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('sitemap', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'XML Sitemap' + ); + + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Store/Setup/InstallSchema.php b/app/code/Magento/Store/Setup/InstallSchema.php index 8f0915ce68ec0..4ea6234e3e25e 100644 --- a/app/code/Magento/Store/Setup/InstallSchema.php +++ b/app/code/Magento/Store/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - $connection = $installer->getConnection(); - - /** - * Create table 'store_website' - */ - $table = $connection->newTable( - $installer->getTable('store_website') - )->addColumn( - 'website_id', - Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Website Id' - )->addColumn( - 'code', - Table::TYPE_TEXT, - 32, - [], - 'Code' - )->addColumn( - 'name', - Table::TYPE_TEXT, - 64, - [], - 'Website Name' - )->addColumn( - 'sort_order', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort Order' - )->addColumn( - 'default_group_id', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Default Group Id' - )->addColumn( - 'is_default', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'default' => '0'], - 'Defines Is Website Default' - )->addIndex( - $installer->getIdxName( - 'store_website', - ['code'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('store_website', ['sort_order']), - ['sort_order'] - )->addIndex( - $installer->getIdxName('store_website', ['default_group_id']), - ['default_group_id'] - )->setComment( - 'Websites' - ); - $connection->createTable($table); - - /** - * Create table 'store_group' - */ - $table = $connection->newTable( - $installer->getTable('store_group') - )->addColumn( - 'group_id', - Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Group Id' - )->addColumn( - 'website_id', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website Id' - )->addColumn( - 'name', - Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Store Group Name' - )->addColumn( - 'root_category_id', - Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Root Category Id' - )->addColumn( - 'default_store_id', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Default Store Id' - )->addIndex( - $installer->getIdxName('store_group', ['website_id']), - ['website_id'] - )->addIndex( - $installer->getIdxName('store_group', ['default_store_id']), - ['default_store_id'] - )->addForeignKey( - $installer->getFkName('store_group', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - Table::ACTION_CASCADE, - Table::ACTION_CASCADE - )->setComment( - 'Store Groups' - ); - $connection->createTable($table); - - /** - * Create table 'store' - */ - $table = $connection->newTable( - $installer->getTable('store') - )->addColumn( - 'store_id', - Table::TYPE_SMALLINT, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Store Id' - )->addColumn( - 'code', - Table::TYPE_TEXT, - 32, - [], - 'Code' - )->addColumn( - 'website_id', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Website Id' - )->addColumn( - 'group_id', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Group Id' - )->addColumn( - 'name', - Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Store Name' - )->addColumn( - 'sort_order', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Sort Order' - )->addColumn( - 'is_active', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Activity' - )->addIndex( - $installer->getIdxName('store', ['code'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), - ['code'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('store', ['website_id']), - ['website_id'] - )->addIndex( - $installer->getIdxName('store', ['is_active', 'sort_order']), - ['is_active', 'sort_order'] - )->addIndex( - $installer->getIdxName('store', ['group_id']), - ['group_id'] - )->addForeignKey( - $installer->getFkName('store', 'group_id', 'store_group', 'group_id'), - 'group_id', - $installer->getTable('store_group'), - 'group_id', - Table::ACTION_CASCADE, - Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('store', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - Table::ACTION_CASCADE, - Table::ACTION_CASCADE - )->setComment( - 'Stores' - ); - $connection->createTable($table); - - /** - * Insert websites - */ - $connection->insertForce( - $installer->getTable('store_website'), - [ - 'website_id' => 0, - 'code' => 'admin', - 'name' => 'Admin', - 'sort_order' => 0, - 'default_group_id' => 0, - 'is_default' => 0 - ] - ); - $connection->insertForce( - $installer->getTable('store_website'), - [ - 'website_id' => 1, - 'code' => 'base', - 'name' => 'Main Website', - 'sort_order' => 0, - 'default_group_id' => 1, - 'is_default' => 1 - ] - ); - - /** - * Insert store groups - */ - $connection->insertForce( - $installer->getTable('store_group'), - ['group_id' => 0, 'website_id' => 0, 'name' => 'Default', 'root_category_id' => 0, 'default_store_id' => 0] - ); - $connection->insertForce( - $installer->getTable('store_group'), - [ - 'group_id' => 1, - 'website_id' => 1, - 'name' => 'Main Website Store', - 'root_category_id' => 2, - 'default_store_id' => 1 - ] - ); - - /** - * Insert stores - */ - $connection->insertForce( - $installer->getTable('store'), - [ - 'store_id' => 0, - 'code' => 'admin', - 'website_id' => 0, - 'group_id' => 0, - 'name' => 'Admin', - 'sort_order' => 0, - 'is_active' => 1 - ] - ); - $connection->insertForce( - $installer->getTable('store'), - [ - 'store_id' => 1, - 'code' => 'default', - 'website_id' => 1, - 'group_id' => 1, - 'name' => 'Default Store View', - 'sort_order' => 0, - 'is_active' => 1 - ] - ); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + $connection = $installer->getConnection(); + + /** + * Create table 'store_website' + */ + $table = $connection->newTable( + $installer->getTable('store_website') + )->addColumn( + 'website_id', + Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website Id' + )->addColumn( + 'code', + Table::TYPE_TEXT, + 32, + [], + 'Code' + )->addColumn( + 'name', + Table::TYPE_TEXT, + 64, + [], + 'Website Name' + )->addColumn( + 'sort_order', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + )->addColumn( + 'default_group_id', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Default Group Id' + )->addColumn( + 'is_default', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Defines Is Website Default' + )->addIndex( + $installer->getIdxName( + 'store_website', + ['code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('store_website', ['sort_order']), + ['sort_order'] + )->addIndex( + $installer->getIdxName('store_website', ['default_group_id']), + ['default_group_id'] + )->setComment( + 'Websites' + ); + $connection->createTable($table); + + /** + * Create table 'store_group' + */ + $table = $connection->newTable( + $installer->getTable('store_group') + )->addColumn( + 'group_id', + Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Group Id' + )->addColumn( + 'website_id', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website Id' + )->addColumn( + 'name', + Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Store Group Name' + )->addColumn( + 'root_category_id', + Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Root Category Id' + )->addColumn( + 'default_store_id', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Default Store Id' + )->addIndex( + $installer->getIdxName('store_group', ['website_id']), + ['website_id'] + )->addIndex( + $installer->getIdxName('store_group', ['default_store_id']), + ['default_store_id'] + )->addForeignKey( + $installer->getFkName('store_group', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + Table::ACTION_CASCADE, + Table::ACTION_CASCADE + )->setComment( + 'Store Groups' + ); + $connection->createTable($table); + + /** + * Create table 'store' + */ + $table = $connection->newTable( + $installer->getTable('store') + )->addColumn( + 'store_id', + Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store Id' + )->addColumn( + 'code', + Table::TYPE_TEXT, + 32, + [], + 'Code' + )->addColumn( + 'website_id', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Website Id' + )->addColumn( + 'group_id', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Group Id' + )->addColumn( + 'name', + Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Store Name' + )->addColumn( + 'sort_order', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Sort Order' + )->addColumn( + 'is_active', + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Activity' + )->addIndex( + $installer->getIdxName('store', + ['code'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['code'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addIndex( + $installer->getIdxName('store', ['website_id']), + ['website_id'] + )->addIndex( + $installer->getIdxName('store', ['is_active', 'sort_order']), + ['is_active', 'sort_order'] + )->addIndex( + $installer->getIdxName('store', ['group_id']), + ['group_id'] + )->addForeignKey( + $installer->getFkName('store', 'group_id', 'store_group', 'group_id'), + 'group_id', + $installer->getTable('store_group'), + 'group_id', + Table::ACTION_CASCADE, + Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('store', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + Table::ACTION_CASCADE, + Table::ACTION_CASCADE + )->setComment( + 'Stores' + ); + $connection->createTable($table); + + /** + * Insert websites + */ + $connection->insertForce( + $installer->getTable('store_website'), + [ + 'website_id' => 0, + 'code' => 'admin', + 'name' => 'Admin', + 'sort_order' => 0, + 'default_group_id' => 0, + 'is_default' => 0 + ] + ); + $connection->insertForce( + $installer->getTable('store_website'), + [ + 'website_id' => 1, + 'code' => 'base', + 'name' => 'Main Website', + 'sort_order' => 0, + 'default_group_id' => 1, + 'is_default' => 1 + ] + ); + + /** + * Insert store groups + */ + $connection->insertForce( + $installer->getTable('store_group'), + ['group_id' => 0, 'website_id' => 0, 'name' => 'Default', 'root_category_id' => 0, 'default_store_id' => 0] + ); + $connection->insertForce( + $installer->getTable('store_group'), + [ + 'group_id' => 1, + 'website_id' => 1, + 'name' => 'Main Website Store', + 'root_category_id' => 2, + 'default_store_id' => 1 + ] + ); + + /** + * Insert stores + */ + $connection->insertForce( + $installer->getTable('store'), + [ + 'store_id' => 0, + 'code' => 'admin', + 'website_id' => 0, + 'group_id' => 0, + 'name' => 'Admin', + 'sort_order' => 0, + 'is_active' => 1 + ] + ); + $connection->insertForce( + $installer->getTable('store'), + [ + 'store_id' => 1, + 'code' => 'default', + 'website_id' => 1, + 'group_id' => 1, + 'name' => 'Default Store View', + 'sort_order' => 0, + 'is_active' => 1 + ] + ); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Tax/Setup/InstallSchema.php b/app/code/Magento/Tax/Setup/InstallSchema.php index 1712be7ea99eb..8ae4526cf7ece 100644 --- a/app/code/Magento/Tax/Setup/InstallSchema.php +++ b/app/code/Magento/Tax/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'tax_class' - */ - $table = $setup->getConnection()->newTable( - $setup->getTable('tax_class') - )->addColumn( - 'class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Class Id' - )->addColumn( - 'class_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Class Name' - )->addColumn( - 'class_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 8, - ['nullable' => false, 'default' => 'CUSTOMER'], - 'Class Type' - )->setComment( - 'Tax Class' - ); - $setup->getConnection()->createTable($table); - - /** - * Create table 'tax_calculation_rule' - */ - $table = $setup->getConnection()->newTable( - $setup->getTable('tax_calculation_rule') - )->addColumn( - 'tax_calculation_rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Tax Calculation Rule Id' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Code' - )->addColumn( - 'priority', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Priority' - )->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Position' - )->addColumn( - 'calculate_subtotal', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Calculate off subtotal option' - )->addIndex( - $setup->getIdxName('tax_calculation_rule', ['priority', 'position']), - ['priority', 'position'] - )->addIndex( - $setup->getIdxName('tax_calculation_rule', ['code']), - ['code'] - )->setComment( - 'Tax Calculation Rule' - ); - $setup->getConnection()->createTable($table); - - /** - * Create table 'tax_calculation_rate' - */ - $table = $setup->getConnection()->newTable( - $setup->getTable('tax_calculation_rate') - )->addColumn( - 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Tax Calculation Rate Id' - )->addColumn( - 'tax_country_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 2, - ['nullable' => false], - 'Tax Country Id' - )->addColumn( - 'tax_region_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Tax Region Id' - )->addColumn( - 'tax_postcode', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 21, - [], - 'Tax Postcode' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Code' - )->addColumn( - 'rate', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Rate' - )->addColumn( - 'zip_is_range', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - [], - 'Zip Is Range' - )->addColumn( - 'zip_from', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Zip From' - )->addColumn( - 'zip_to', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true], - 'Zip To' - )->addIndex( - $setup->getIdxName('tax_calculation_rate', ['tax_country_id', 'tax_region_id', 'tax_postcode']), - ['tax_country_id', 'tax_region_id', 'tax_postcode'] - )->addIndex( - $setup->getIdxName('tax_calculation_rate', ['code']), - ['code'] - )->addIndex( - $setup->getIdxName( - 'tax_calculation_rate', - ['tax_calculation_rate_id', 'tax_country_id', 'tax_region_id', 'zip_is_range', 'tax_postcode'] - ), - ['tax_calculation_rate_id', 'tax_country_id', 'tax_region_id', 'zip_is_range', 'tax_postcode'] - )->setComment( - 'Tax Calculation Rate' - ); - $setup->getConnection()->createTable($table); - - /** - * Create table 'tax_calculation' - */ - $table = $setup->getConnection()->newTable( - $setup->getTable('tax_calculation') - )->addColumn( - 'tax_calculation_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Tax Calculation Id' - )->addColumn( - 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Tax Calculation Rate Id' - )->addColumn( - 'tax_calculation_rule_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Tax Calculation Rule Id' - )->addColumn( - 'customer_tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false], - 'Customer Tax Class Id' - )->addColumn( - 'product_tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false], - 'Product Tax Class Id' - )->addIndex( - $setup->getIdxName('tax_calculation', ['tax_calculation_rule_id']), - ['tax_calculation_rule_id'] - )->addIndex( - $setup->getIdxName('tax_calculation', ['customer_tax_class_id']), - ['customer_tax_class_id'] - )->addIndex( - $setup->getIdxName('tax_calculation', ['product_tax_class_id']), - ['product_tax_class_id'] - )->addIndex( - $setup->getIdxName( - 'tax_calculation', - ['tax_calculation_rate_id', 'customer_tax_class_id', 'product_tax_class_id'] - ), - ['tax_calculation_rate_id', 'customer_tax_class_id', 'product_tax_class_id'] - )->addForeignKey( - $setup->getFkName('tax_calculation', 'product_tax_class_id', 'tax_class', 'class_id'), - 'product_tax_class_id', - $setup->getTable('tax_class'), - 'class_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $setup->getFkName('tax_calculation', 'customer_tax_class_id', 'tax_class', 'class_id'), - 'customer_tax_class_id', - $setup->getTable('tax_class'), - 'class_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $setup->getFkName( - 'tax_calculation', - 'tax_calculation_rate_id', - 'tax_calculation_rate', - 'tax_calculation_rate_id' - ), - 'tax_calculation_rate_id', - $setup->getTable('tax_calculation_rate'), - 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $setup->getFkName( - 'tax_calculation', - 'tax_calculation_rule_id', - 'tax_calculation_rule', - 'tax_calculation_rule_id' - ), - 'tax_calculation_rule_id', - $setup->getTable('tax_calculation_rule'), - 'tax_calculation_rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Tax Calculation' - ); - $setup->getConnection()->createTable($table); - - /** - * Create table 'tax_calculation_rate_title' - */ - $table = $setup->getConnection()->newTable( - $setup->getTable('tax_calculation_rate_title') - )->addColumn( - 'tax_calculation_rate_title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Tax Calculation Rate Title Id' - )->addColumn( - 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Tax Calculation Rate Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Value' - )->addIndex( - $setup->getIdxName('tax_calculation_rate_title', ['tax_calculation_rate_id', 'store_id']), - ['tax_calculation_rate_id', 'store_id'] - )->addIndex( - $setup->getIdxName('tax_calculation_rate_title', ['store_id']), - ['store_id'] - )->addForeignKey( - $setup->getFkName('tax_calculation_rate_title', 'store_id', 'store', 'store_id'), - 'store_id', - $setup->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $setup->getFkName( - 'tax_calculation_rate_title', - 'tax_calculation_rate_id', - 'tax_calculation_rate', - 'tax_calculation_rate_id' - ), - 'tax_calculation_rate_id', - $setup->getTable('tax_calculation_rate'), - 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Tax Calculation Rate Title' - ); - $setup->getConnection()->createTable($table); - - /** - * Create table 'tax_order_aggregated_created' - */ - $table = $setup->getConnection()->newTable( - $setup->getTable('tax_order_aggregated_created') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Id' - )->addColumn( - 'period', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable' => true], - 'Period' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true], - 'Store Id' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Code' - )->addColumn( - 'order_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - ['nullable' => false], - 'Order Status' - )->addColumn( - 'percent', - \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, - null, - [], - 'Percent' - )->addColumn( - 'orders_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Orders Count' - )->addColumn( - 'tax_base_amount_sum', - \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, - null, - [], - 'Tax Base Amount Sum' - )->addIndex( - $setup->getIdxName( - 'tax_order_aggregated_created', - ['period', 'store_id', 'code', 'percent', 'order_status'], - true - ), - ['period', 'store_id', 'code', 'percent', 'order_status'], - ['type' => 'unique'] - )->addIndex( - $setup->getIdxName('tax_order_aggregated_created', ['store_id']), - ['store_id'] - )->addForeignKey( - $setup->getFkName('tax_order_aggregated_created', 'store_id', 'store', 'store_id'), - 'store_id', - $setup->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Tax Order Aggregation' - ); - $setup->getConnection()->createTable($table); - - /** - * Create table 'tax_order_aggregated_updated' - */ - $setup->getConnection()->createTable( - $setup->getConnection()->createTableByDdl( - $setup->getTable('tax_order_aggregated_created'), - $setup->getTable('tax_order_aggregated_updated') - ) - ); - - /** - * Create table 'sales_order_tax_item' - */ - $table = $setup->getConnection()->newTable( - $setup->getTable('sales_order_tax_item') - )->addColumn( - 'tax_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Tax Item Id' - )->addColumn( - 'tax_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Tax Id' - )->addColumn( - 'item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => true], - 'Item Id' - )->addColumn( - 'tax_percent', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Real Tax Percent For Item' - )->addColumn( - 'amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Tax amount for the item and tax rate' - )->addColumn( - 'base_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Base tax amount for the item and tax rate' - )->addColumn( - 'real_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Real tax amount for the item and tax rate' - )->addColumn( - 'real_base_amount', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Real base tax amount for the item and tax rate' - )->addColumn( - 'associated_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => true, 'unsigned' => true], - 'Id of the associated item' - )->addColumn( - 'taxable_item_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Type of the taxable item' - )->addIndex( - $setup->getIdxName('sales_order_tax_item', ['item_id']), - ['item_id'] - )->addIndex( - $setup->getIdxName( - 'sales_order_tax_item', - ['tax_id', 'item_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['tax_id', 'item_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $setup->getFkName('sales_order_tax_item', 'associated_item_id', 'sales_order_item', 'item_id'), - 'associated_item_id', - $setup->getTable('sales_order_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $setup->getFkName('sales_order_tax_item', 'tax_id', 'sales_order_tax', 'tax_id'), - 'tax_id', - $setup->getTable('sales_order_tax'), - 'tax_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $setup->getFkName('sales_order_tax_item', 'item_id', 'sales_order_item', 'item_id'), - 'item_id', - $setup->getTable('sales_order_item'), - 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Sales Order Tax Item' - ); - $setup->getConnection()->createTable($table); - - $setup->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $setup->startSetup(); + + /** + * Create table 'tax_class' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_class') + )->addColumn( + 'class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Class Id' + )->addColumn( + 'class_name', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Class Name' + )->addColumn( + 'class_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 8, + ['nullable' => false, 'default' => 'CUSTOMER'], + 'Class Type' + )->setComment( + 'Tax Class' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_calculation_rule' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_calculation_rule') + )->addColumn( + 'tax_calculation_rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Tax Calculation Rule Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Code' + )->addColumn( + 'priority', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Priority' + )->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Position' + )->addColumn( + 'calculate_subtotal', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Calculate off subtotal option' + )->addIndex( + $setup->getIdxName('tax_calculation_rule', ['priority', 'position']), + ['priority', 'position'] + )->addIndex( + $setup->getIdxName('tax_calculation_rule', ['code']), + ['code'] + )->setComment( + 'Tax Calculation Rule' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_calculation_rate' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_calculation_rate') + )->addColumn( + 'tax_calculation_rate_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Tax Calculation Rate Id' + )->addColumn( + 'tax_country_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 2, + ['nullable' => false], + 'Tax Country Id' + )->addColumn( + 'tax_region_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Tax Region Id' + )->addColumn( + 'tax_postcode', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 21, + [], + 'Tax Postcode' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Code' + )->addColumn( + 'rate', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Rate' + )->addColumn( + 'zip_is_range', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + [], + 'Zip Is Range' + )->addColumn( + 'zip_from', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Zip From' + )->addColumn( + 'zip_to', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Zip To' + )->addIndex( + $setup->getIdxName('tax_calculation_rate', ['tax_country_id', 'tax_region_id', 'tax_postcode']), + ['tax_country_id', 'tax_region_id', 'tax_postcode'] + )->addIndex( + $setup->getIdxName('tax_calculation_rate', ['code']), + ['code'] + )->addIndex( + $setup->getIdxName( + 'tax_calculation_rate', + ['tax_calculation_rate_id', 'tax_country_id', 'tax_region_id', 'zip_is_range', 'tax_postcode'] + ), + ['tax_calculation_rate_id', 'tax_country_id', 'tax_region_id', 'zip_is_range', 'tax_postcode'] + )->setComment( + 'Tax Calculation Rate' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_calculation' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_calculation') + )->addColumn( + 'tax_calculation_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Tax Calculation Id' + )->addColumn( + 'tax_calculation_rate_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Tax Calculation Rate Id' + )->addColumn( + 'tax_calculation_rule_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Tax Calculation Rule Id' + )->addColumn( + 'customer_tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false], + 'Customer Tax Class Id' + )->addColumn( + 'product_tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false], + 'Product Tax Class Id' + )->addIndex( + $setup->getIdxName('tax_calculation', ['tax_calculation_rule_id']), + ['tax_calculation_rule_id'] + )->addIndex( + $setup->getIdxName('tax_calculation', ['customer_tax_class_id']), + ['customer_tax_class_id'] + )->addIndex( + $setup->getIdxName('tax_calculation', ['product_tax_class_id']), + ['product_tax_class_id'] + )->addIndex( + $setup->getIdxName( + 'tax_calculation', + ['tax_calculation_rate_id', 'customer_tax_class_id', 'product_tax_class_id'] + ), + ['tax_calculation_rate_id', 'customer_tax_class_id', 'product_tax_class_id'] + )->addForeignKey( + $setup->getFkName('tax_calculation', 'product_tax_class_id', 'tax_class', 'class_id'), + 'product_tax_class_id', + $setup->getTable('tax_class'), + 'class_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName('tax_calculation', 'customer_tax_class_id', 'tax_class', 'class_id'), + 'customer_tax_class_id', + $setup->getTable('tax_class'), + 'class_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName( + 'tax_calculation', + 'tax_calculation_rate_id', + 'tax_calculation_rate', + 'tax_calculation_rate_id' + ), + 'tax_calculation_rate_id', + $setup->getTable('tax_calculation_rate'), + 'tax_calculation_rate_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName( + 'tax_calculation', + 'tax_calculation_rule_id', + 'tax_calculation_rule', + 'tax_calculation_rule_id' + ), + 'tax_calculation_rule_id', + $setup->getTable('tax_calculation_rule'), + 'tax_calculation_rule_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Tax Calculation' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_calculation_rate_title' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_calculation_rate_title') + )->addColumn( + 'tax_calculation_rate_title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Tax Calculation Rate Title Id' + )->addColumn( + 'tax_calculation_rate_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Tax Calculation Rate Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Value' + )->addIndex( + $setup->getIdxName('tax_calculation_rate_title', ['tax_calculation_rate_id', 'store_id']), + ['tax_calculation_rate_id', 'store_id'] + )->addIndex( + $setup->getIdxName('tax_calculation_rate_title', ['store_id']), + ['store_id'] + )->addForeignKey( + $setup->getFkName('tax_calculation_rate_title', 'store_id', 'store', 'store_id'), + 'store_id', + $setup->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName( + 'tax_calculation_rate_title', + 'tax_calculation_rate_id', + 'tax_calculation_rate', + 'tax_calculation_rate_id' + ), + 'tax_calculation_rate_id', + $setup->getTable('tax_calculation_rate'), + 'tax_calculation_rate_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Tax Calculation Rate Title' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_order_aggregated_created' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('tax_order_aggregated_created') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'period', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + ['nullable' => true], + 'Period' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Code' + )->addColumn( + 'order_status', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => false], + 'Order Status' + )->addColumn( + 'percent', + \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, + null, + [], + 'Percent' + )->addColumn( + 'orders_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Orders Count' + )->addColumn( + 'tax_base_amount_sum', + \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, + null, + [], + 'Tax Base Amount Sum' + )->addIndex( + $setup->getIdxName( + 'tax_order_aggregated_created', + ['period', 'store_id', 'code', 'percent', 'order_status'], + true + ), + ['period', 'store_id', 'code', 'percent', 'order_status'], + ['type' => 'unique'] + )->addIndex( + $setup->getIdxName('tax_order_aggregated_created', ['store_id']), + ['store_id'] + )->addForeignKey( + $setup->getFkName('tax_order_aggregated_created', 'store_id', 'store', 'store_id'), + 'store_id', + $setup->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Tax Order Aggregation' + ); + $setup->getConnection()->createTable($table); + + /** + * Create table 'tax_order_aggregated_updated' + */ + $setup->getConnection()->createTable( + $setup->getConnection()->createTableByDdl( + $setup->getTable('tax_order_aggregated_created'), + $setup->getTable('tax_order_aggregated_updated') + ) + ); + + /** + * Create table 'sales_order_tax_item' + */ + $table = $setup->getConnection()->newTable( + $setup->getTable('sales_order_tax_item') + )->addColumn( + 'tax_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Tax Item Id' + )->addColumn( + 'tax_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Tax Id' + )->addColumn( + 'item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => true], + 'Item Id' + )->addColumn( + 'tax_percent', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Real Tax Percent For Item' + )->addColumn( + 'amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Tax amount for the item and tax rate' + )->addColumn( + 'base_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Base tax amount for the item and tax rate' + )->addColumn( + 'real_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Real tax amount for the item and tax rate' + )->addColumn( + 'real_base_amount', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Real base tax amount for the item and tax rate' + )->addColumn( + 'associated_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => true, 'unsigned' => true], + 'Id of the associated item' + )->addColumn( + 'taxable_item_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Type of the taxable item' + )->addIndex( + $setup->getIdxName('sales_order_tax_item', ['item_id']), + ['item_id'] + )->addIndex( + $setup->getIdxName( + 'sales_order_tax_item', + ['tax_id', 'item_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['tax_id', 'item_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $setup->getFkName('sales_order_tax_item', 'associated_item_id', 'sales_order_item', 'item_id'), + 'associated_item_id', + $setup->getTable('sales_order_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName('sales_order_tax_item', 'tax_id', 'sales_order_tax', 'tax_id'), + 'tax_id', + $setup->getTable('sales_order_tax'), + 'tax_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $setup->getFkName('sales_order_tax_item', 'item_id', 'sales_order_item', 'item_id'), + 'item_id', + $setup->getTable('sales_order_item'), + 'item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Sales Order Tax Item' + ); + $setup->getConnection()->createTable($table); + + $setup->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Theme/Setup/InstallSchema.php b/app/code/Magento/Theme/Setup/InstallSchema.php index c2fa7460dec0f..9faeb3bc17671 100644 --- a/app/code/Magento/Theme/Setup/InstallSchema.php +++ b/app/code/Magento/Theme/Setup/InstallSchema.php @@ -1,11 +1,8 @@ getConnection(); - - $installer->startSetup(); - - /** - * Create table 'theme' - */ - $table = $connection->newTable( - $installer->getTable('theme') - )->addColumn( - 'theme_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Theme identifier' - )->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => true], - 'Parent Id' - )->addColumn( - 'theme_path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 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, - 255, - ['nullable' => false], - 'Theme Title' - )->addColumn( - 'preview_image', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Preview Image' - )->addColumn( - 'is_featured', - \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - null, - ['nullable' => false, 'default' => 0], - 'Is Theme Featured' - )->addColumn( - 'area', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Theme Area' - )->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false], - 'Theme type: 0:physical, 1:virtual, 2:staging' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'Full theme code, including package' - )->setComment( - 'Core theme' - ); - $connection->createTable($table); - - /** - * Create table 'theme_file' - */ - $table = $connection->newTable( - $installer->getTable('theme_file') - )->addColumn( - 'theme_files_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Theme files identifier' - )->addColumn( - 'theme_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, 'unsigned' => true], - 'Theme Id' - )->addColumn( - 'file_path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Relative path to file' - )->addColumn( - 'file_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'File Type' - )->addColumn( - 'content', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - \Magento\Framework\DB\Ddl\Table::MAX_TEXT_SIZE, - ['nullable' => false], - 'File Content' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0], - 'Sort Order' - )->addColumn( - 'is_temporary', - \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - null, - ['nullable' => false, 'default' => 0], - 'Is Temporary File' - )->addForeignKey( - $installer->getFkName('theme_file', 'theme_id', 'theme', 'theme_id'), - 'theme_id', - $installer->getTable('theme'), - 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Core theme files' - ); - $connection->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + /* @var $connection \Magento\Framework\DB\Adapter\AdapterInterface */ + $connection = $installer->getConnection(); + + $installer->startSetup(); + + /** + * Create table 'theme' + */ + $table = $connection->newTable( + $installer->getTable('theme') + )->addColumn( + 'theme_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Theme identifier' + )->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => true], + 'Parent Id' + )->addColumn( + 'theme_path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 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, + 255, + ['nullable' => false], + 'Theme Title' + )->addColumn( + 'preview_image', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Preview Image' + )->addColumn( + 'is_featured', + \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, + null, + ['nullable' => false, 'default' => 0], + 'Is Theme Featured' + )->addColumn( + 'area', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Theme Area' + )->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false], + 'Theme type: 0:physical, 1:virtual, 2:staging' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'Full theme code, including package' + )->setComment( + 'Core theme' + ); + $connection->createTable($table); + + /** + * Create table 'theme_file' + */ + $table = $connection->newTable( + $installer->getTable('theme_file') + )->addColumn( + 'theme_files_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Theme files identifier' + )->addColumn( + 'theme_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Theme Id' + )->addColumn( + 'file_path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Relative path to file' + )->addColumn( + 'file_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'File Type' + )->addColumn( + 'content', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + \Magento\Framework\DB\Ddl\Table::MAX_TEXT_SIZE, + ['nullable' => false], + 'File Content' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0], + 'Sort Order' + )->addColumn( + 'is_temporary', + \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, + null, + ['nullable' => false, 'default' => 0], + 'Is Temporary File' + )->addForeignKey( + $installer->getFkName('theme_file', 'theme_id', 'theme', 'theme_id'), + 'theme_id', + $installer->getTable('theme'), + 'theme_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Core theme files' + ); + $connection->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Theme/Setup/UpgradeSchema.php b/app/code/Magento/Theme/Setup/UpgradeSchema.php index 9629c9ff77b35..cac403af3b558 100644 --- a/app/code/Magento/Theme/Setup/UpgradeSchema.php +++ b/app/code/Magento/Theme/Setup/UpgradeSchema.php @@ -1,11 +1,8 @@ getVersion(), '2.0.1') <= 0) { $installer = $setup; @@ -35,5 +32,5 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } - } + } } \ No newline at end of file diff --git a/app/code/Magento/Translation/Setup/InstallSchema.php b/app/code/Magento/Translation/Setup/InstallSchema.php index 1c43a32aa42b4..fd106cba2bc39 100644 --- a/app/code/Magento/Translation/Setup/InstallSchema.php +++ b/app/code/Magento/Translation/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'translation' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('translation')) - ->addColumn( - 'key_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [ - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], - 'Key Id of Translation' - )->addColumn( - 'string', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [ - 'nullable' => false, - 'default' => 'Translate String', - ], - 'Translation String' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - [ - 'unsigned' => true, - 'nullable' => false, - 'default' => '0', - ], - 'Store Id' - )->addColumn( - 'translate', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Translate' - )->addColumn( - 'locale', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 20, - [ - 'nullable' => false, - 'default' => 'en_US', - ], - 'Locale' - )->addColumn( - 'crc_string', - \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, - null, - [ - 'nullable' => false, - 'default' => crc32('Translate String') - ], - 'Translation String CRC32 Hash' - )->addIndex( - $installer->getIdxName( - 'translation', - ['store_id', 'locale', 'crc_string', 'string'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['store_id', 'locale', 'crc_string', 'string'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('translation', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment('Translations'); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'translation' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('translation')) + ->addColumn( + 'key_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [ + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ], + 'Key Id of Translation' + )->addColumn( + 'string', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [ + 'nullable' => false, + 'default' => 'Translate String', + ], + 'Translation String' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + [ + 'unsigned' => true, + 'nullable' => false, + 'default' => '0', + ], + 'Store Id' + )->addColumn( + 'translate', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Translate' + )->addColumn( + 'locale', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 20, + [ + 'nullable' => false, + 'default' => 'en_US', + ], + 'Locale' + )->addColumn( + 'crc_string', + \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, + null, + [ + 'nullable' => false, + 'default' => crc32('Translate String') + ], + 'Translation String CRC32 Hash' + )->addIndex( + $installer->getIdxName( + 'translation', + ['store_id', 'locale', 'crc_string', 'string'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['store_id', 'locale', 'crc_string', 'string'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('translation', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment('Translations'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/UrlRewrite/Setup/InstallSchema.php b/app/code/Magento/UrlRewrite/Setup/InstallSchema.php index 02d3d818759ae..d6987ea148a53 100644 --- a/app/code/Magento/UrlRewrite/Setup/InstallSchema.php +++ b/app/code/Magento/UrlRewrite/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'url_rewrite' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('url_rewrite')) - ->addColumn( - 'url_rewrite_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Rewrite Id' - ) - ->addColumn( - 'entity_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => false], - 'Entity type code' - ) - ->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Entity ID' - ) - ->addColumn( - 'request_path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Request Path' - ) - ->addColumn( - 'target_path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Target Path' - ) - ->addColumn( - 'redirect_type', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Redirect Type' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store Id' - ) - ->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Description' - ) - ->addColumn( - 'is_autogenerated', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Is rewrite generated automatically flag' - ) - ->addColumn( - 'metadata', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Meta data for url rewrite' - ) - ->addIndex( - $installer->getIdxName( - 'url_rewrite', - ['request_path', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['request_path', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName('url_rewrite', ['target_path']), - ['target_path'] - ) - ->addIndex( - $installer->getIdxName('url_rewrite', ['store_id', 'entity_id']), - ['store_id', 'entity_id'] - ) - ->setComment('Url Rewrites'); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'url_rewrite' + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('url_rewrite')) + ->addColumn( + 'url_rewrite_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Rewrite Id' + ) + ->addColumn( + 'entity_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Entity type code' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Entity ID' + ) + ->addColumn( + 'request_path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Request Path' + ) + ->addColumn( + 'target_path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Target Path' + ) + ->addColumn( + 'redirect_type', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Redirect Type' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Store Id' + ) + ->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Description' + ) + ->addColumn( + 'is_autogenerated', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0], + 'Is rewrite generated automatically flag' + ) + ->addColumn( + 'metadata', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Meta data for url rewrite' + ) + ->addIndex( + $installer->getIdxName( + 'url_rewrite', + ['request_path', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['request_path', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('url_rewrite', ['target_path']), + ['target_path'] + ) + ->addIndex( + $installer->getIdxName('url_rewrite', ['store_id', 'entity_id']), + ['store_id', 'entity_id'] + ) + ->setComment('Url Rewrites'); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/User/Setup/InstallSchema.php b/app/code/Magento/User/Setup/InstallSchema.php index d291204ca7514..a2041a4a3dd52 100644 --- a/app/code/Magento/User/Setup/InstallSchema.php +++ b/app/code/Magento/User/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'admin_user' - */ - if (!$installer->getConnection()->isTableExists($installer->getTable('admin_user'))) { - $table = $installer->getConnection()->newTable( - $installer->getTable('admin_user') - )->addColumn( - 'user_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'User ID' - )->addColumn( - 'firstname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true], - 'User First Name' - )->addColumn( - 'lastname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - ['nullable' => true], - 'User Last Name' - )->addColumn( - 'email', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 128, - ['nullable' => true], - 'User Email' - )->addColumn( - 'username', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - ['nullable' => true], - 'User Login' - )->addColumn( - 'password', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'User Password' - )->addColumn( - 'created', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], - 'User Created Time' - )->addColumn( - 'modified', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'User Modified Time' - )->addColumn( - 'logdate', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'User Last Login Time' - )->addColumn( - 'lognum', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'User Login Number' - )->addColumn( - 'reload_acl_flag', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '0'], - 'Reload ACL' - )->addColumn( - 'is_active', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => '1'], - 'User Is Active' - )->addColumn( - 'extra', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'User Extra Data' - )->addColumn( - 'rp_token', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 256, - ['nullable' => true, 'default' => null], - 'Reset Password Link Token' - )->addColumn( - 'rp_token_created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => true, 'default' => null], - 'Reset Password Link Token Creation Date' - )->addColumn( - 'interface_locale', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 5, - ['nullable' => false, 'default' => 'en_US'], - 'Backend interface locale' - )->addIndex( - $installer->getIdxName( - 'admin_user', - ['username'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['username'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->setComment( - 'Admin User Table' - ); - $installer->getConnection()->createTable($table); - } - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'admin_user' + */ + if (!$installer->getConnection()->isTableExists($installer->getTable('admin_user'))) { + $table = $installer->getConnection()->newTable( + $installer->getTable('admin_user') + )->addColumn( + 'user_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'User ID' + )->addColumn( + 'firstname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true], + 'User First Name' + )->addColumn( + 'lastname', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true], + 'User Last Name' + )->addColumn( + 'email', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 128, + ['nullable' => true], + 'User Email' + )->addColumn( + 'username', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 40, + ['nullable' => true], + 'User Login' + )->addColumn( + 'password', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'User Password' + )->addColumn( + 'created', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], + 'User Created Time' + )->addColumn( + 'modified', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'User Modified Time' + )->addColumn( + 'logdate', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'User Last Login Time' + )->addColumn( + 'lognum', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'User Login Number' + )->addColumn( + 'reload_acl_flag', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Reload ACL' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'User Is Active' + )->addColumn( + 'extra', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'User Extra Data' + )->addColumn( + 'rp_token', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 256, + ['nullable' => true, 'default' => null], + 'Reset Password Link Token' + )->addColumn( + 'rp_token_created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => true, 'default' => null], + 'Reset Password Link Token Creation Date' + )->addColumn( + 'interface_locale', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 5, + ['nullable' => false, 'default' => 'en_US'], + 'Backend interface locale' + )->addIndex( + $installer->getIdxName( + 'admin_user', + ['username'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['username'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->setComment( + 'Admin User Table' + ); + $installer->getConnection()->createTable($table); + } + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Weee/Setup/InstallSchema.php b/app/code/Magento/Weee/Setup/InstallSchema.php index 191943200cb0b..1ac0954fdec4a 100644 --- a/app/code/Magento/Weee/Setup/InstallSchema.php +++ b/app/code/Magento/Weee/Setup/InstallSchema.php @@ -1,11 +1,8 @@ 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_TEXT, - 255, - ['nullable' => false, 'default' => '*'], - 'State' - )->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Attribute Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Entity Type 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 $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_TEXT, + 255, + ['nullable' => false, 'default' => '*'], + 'State' + )->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Attribute Id' + )->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Entity Type 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(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Weee/Setup/UpgradeSchema.php b/app/code/Magento/Weee/Setup/UpgradeSchema.php index 3c131d78c3d92..f092ae4c8b075 100644 --- a/app/code/Magento/Weee/Setup/UpgradeSchema.php +++ b/app/code/Magento/Weee/Setup/UpgradeSchema.php @@ -1,11 +1,8 @@ getVersion(), '2.0.0.1') <= 0) { $setup->startSetup(); $connection = $setup->getConnection(); @@ -28,5 +25,5 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $setup->endSetup(); } - } + } } \ No newline at end of file diff --git a/app/code/Magento/Widget/Setup/InstallSchema.php b/app/code/Magento/Widget/Setup/InstallSchema.php index 70f54374cae13..d2ee20718faa2 100644 --- a/app/code/Magento/Widget/Setup/InstallSchema.php +++ b/app/code/Magento/Widget/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'widget' - */ - if (!$installer->getConnection()->isTableExists($installer->getTable('widget'))) { - $table = $installer->getConnection()->newTable( - $installer->getTable('widget') - )->addColumn( - 'widget_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Widget Id' - )->addColumn( - 'widget_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Widget code for template directive' - )->addColumn( - 'widget_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Widget Type' - )->addColumn( - 'parameters', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Parameters' - )->addIndex( - $installer->getIdxName('widget', 'widget_code'), - 'widget_code' - )->setComment( - 'Preconfigured Widgets' - ); - $installer->getConnection()->createTable($table); - } else { - $installer->getConnection()->dropIndex($installer->getTable('widget'), 'IDX_CODE'); - - $tables = [ - $installer->getTable( - 'widget' - ) => [ - 'columns' => [ - 'widget_id' => [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - 'comment' => 'Widget Id', - ], - 'parameters' => [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'length' => '64K', - 'comment' => 'Parameters', - ], - ], - 'comment' => 'Preconfigured Widgets', - ], - ]; - - $installer->getConnection()->modifyTables($tables); - - $installer->getConnection()->changeColumn( - $installer->getTable('widget'), - 'code', - 'widget_code', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'length' => 255, - 'comment' => 'Widget code for template directive' - ] - ); - - $installer->getConnection()->changeColumn( - $installer->getTable('widget'), - 'type', - 'widget_type', - ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Widget Type'] - ); - - $installer->getConnection()->addIndex( - $installer->getTable('widget'), - $installer->getIdxName('widget', ['widget_code']), - ['widget_code'] - ); - } - - /** - * Create table 'widget_instance' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('widget_instance') - )->addColumn( - 'instance_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Instance Id' - )->addColumn( - 'instance_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Instance Type' - )->addColumn( - 'theme_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Theme id' - )->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Widget Title' - )->addColumn( - 'store_ids', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false, 'default' => '0'], - 'Store ids' - )->addColumn( - 'widget_parameters', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Widget parameters' - )->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sort order' - )->addForeignKey( - $installer->getFkName('widget_instance', 'theme_id', 'theme', 'theme_id'), - 'theme_id', - $installer->getTable('theme'), - 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Instances of Widget for Package Theme' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'widget_instance_page' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('widget_instance_page') - )->addColumn( - 'page_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Page Id' - )->addColumn( - 'instance_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Instance Id' - )->addColumn( - 'page_group', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 25, - [], - 'Block Group Type' - )->addColumn( - 'layout_handle', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Layout Handle' - )->addColumn( - 'block_reference', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Container' - )->addColumn( - 'page_for', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 25, - [], - 'For instance entities' - )->addColumn( - 'entities', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Catalog entities (comma separated)' - )->addColumn( - 'page_template', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Path to widget template' - )->addIndex( - $installer->getIdxName('widget_instance_page', 'instance_id'), - 'instance_id' - )->addForeignKey( - $installer->getFkName('widget_instance_page', 'instance_id', 'widget_instance', 'instance_id'), - 'instance_id', - $installer->getTable('widget_instance'), - 'instance_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Instance of Widget on Page' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'widget_instance_page_layout' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('widget_instance_page_layout') - )->addColumn( - 'page_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Page Id' - )->addColumn( - 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Layout Update Id' - )->addIndex( - $installer->getIdxName('widget_instance_page_layout', 'page_id'), - 'page_id' - )->addIndex( - $installer->getIdxName( - 'widget_instance_page_layout', - ['layout_update_id', 'page_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['layout_update_id', 'page_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('widget_instance_page_layout', 'page_id', 'widget_instance_page', 'page_id'), - 'page_id', - $installer->getTable('widget_instance_page'), - 'page_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('widget_instance_page_layout', 'layout_update_id', 'core_layout_update', 'layout_update_id'), - 'layout_update_id', - $installer->getTable('core_layout_update'), - 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Layout updates' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'widget' + */ + if (!$installer->getConnection()->isTableExists($installer->getTable('widget'))) { + $table = $installer->getConnection()->newTable( + $installer->getTable('widget') + )->addColumn( + 'widget_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Widget Id' + )->addColumn( + 'widget_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Widget code for template directive' + )->addColumn( + 'widget_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Widget Type' + )->addColumn( + 'parameters', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Parameters' + )->addIndex( + $installer->getIdxName('widget', 'widget_code'), + 'widget_code' + )->setComment( + 'Preconfigured Widgets' + ); + $installer->getConnection()->createTable($table); + } else { + $installer->getConnection()->dropIndex($installer->getTable('widget'), 'IDX_CODE'); + + $tables = [ + $installer->getTable( + 'widget' + ) => [ + 'columns' => [ + 'widget_id' => [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + 'comment' => 'Widget Id', + ], + 'parameters' => [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'length' => '64K', + 'comment' => 'Parameters', + ], + ], + 'comment' => 'Preconfigured Widgets', + ], + ]; + + $installer->getConnection()->modifyTables($tables); + + $installer->getConnection()->changeColumn( + $installer->getTable('widget'), + 'code', + 'widget_code', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'length' => 255, + 'comment' => 'Widget code for template directive' + ] + ); + + $installer->getConnection()->changeColumn( + $installer->getTable('widget'), + 'type', + 'widget_type', + ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Widget Type'] + ); + + $installer->getConnection()->addIndex( + $installer->getTable('widget'), + $installer->getIdxName('widget', ['widget_code']), + ['widget_code'] + ); + } + + /** + * Create table 'widget_instance' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('widget_instance') + )->addColumn( + 'instance_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Instance Id' + )->addColumn( + 'instance_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Instance Type' + )->addColumn( + 'theme_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Theme id' + )->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Widget Title' + )->addColumn( + 'store_ids', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false, 'default' => '0'], + 'Store ids' + )->addColumn( + 'widget_parameters', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Widget parameters' + )->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort order' + )->addForeignKey( + $installer->getFkName('widget_instance', 'theme_id', 'theme', 'theme_id'), + 'theme_id', + $installer->getTable('theme'), + 'theme_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Instances of Widget for Package Theme' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'widget_instance_page' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('widget_instance_page') + )->addColumn( + 'page_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Page Id' + )->addColumn( + 'instance_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Instance Id' + )->addColumn( + 'page_group', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 25, + [], + 'Block Group Type' + )->addColumn( + 'layout_handle', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Layout Handle' + )->addColumn( + 'block_reference', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Container' + )->addColumn( + 'page_for', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 25, + [], + 'For instance entities' + )->addColumn( + 'entities', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Catalog entities (comma separated)' + )->addColumn( + 'page_template', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Path to widget template' + )->addIndex( + $installer->getIdxName('widget_instance_page', 'instance_id'), + 'instance_id' + )->addForeignKey( + $installer->getFkName('widget_instance_page', 'instance_id', 'widget_instance', 'instance_id'), + 'instance_id', + $installer->getTable('widget_instance'), + 'instance_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Instance of Widget on Page' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'widget_instance_page_layout' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('widget_instance_page_layout') + )->addColumn( + 'page_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Page Id' + )->addColumn( + 'layout_update_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Layout Update Id' + )->addIndex( + $installer->getIdxName('widget_instance_page_layout', 'page_id'), + 'page_id' + )->addIndex( + $installer->getIdxName( + 'widget_instance_page_layout', + ['layout_update_id', 'page_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['layout_update_id', 'page_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('widget_instance_page_layout', 'page_id', 'widget_instance_page', 'page_id'), + 'page_id', + $installer->getTable('widget_instance_page'), + 'page_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addForeignKey( + $installer->getFkName('widget_instance_page_layout', + 'layout_update_id', + 'core_layout_update', + 'layout_update_id' + ), + 'layout_update_id', + $installer->getTable('core_layout_update'), + 'layout_update_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Layout updates' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file diff --git a/app/code/Magento/Wishlist/Setup/InstallSchema.php b/app/code/Magento/Wishlist/Setup/InstallSchema.php index aef56a8cbc7ea..6ca08c8c95d1d 100644 --- a/app/code/Magento/Wishlist/Setup/InstallSchema.php +++ b/app/code/Magento/Wishlist/Setup/InstallSchema.php @@ -1,11 +1,8 @@ startSetup(); - - /** - * Create table 'wishlist' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('wishlist') - )->addColumn( - 'wishlist_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Wishlist ID' - )->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Customer ID' - )->addColumn( - 'shared', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Sharing flag (0 or 1)' - )->addColumn( - 'sharing_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - [], - 'Sharing encrypted code' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Last updated date' - )->addIndex( - $installer->getIdxName('wishlist', 'shared'), - 'shared' - )->addIndex( - $installer->getIdxName('wishlist', 'customer_id', \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), - 'customer_id', - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addForeignKey( - $installer->getFkName('wishlist', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Wishlist main Table' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'wishlist_item' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('wishlist_item') - )->addColumn( - 'wishlist_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Wishlist item ID' - )->addColumn( - 'wishlist_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Wishlist ID' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product ID' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => true], - 'Store ID' - )->addColumn( - 'added_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [], - 'Add date and time' - )->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Short description of wish list item' - )->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - ['nullable' => false], - 'Qty' - )->addIndex( - $installer->getIdxName('wishlist_item', 'wishlist_id'), - 'wishlist_id' - )->addForeignKey( - $installer->getFkName('wishlist_item', 'wishlist_id', 'wishlist', 'wishlist_id'), - 'wishlist_id', - $installer->getTable('wishlist'), - 'wishlist_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addIndex( - $installer->getIdxName('wishlist_item', 'product_id'), - 'product_id' - )->addForeignKey( - $installer->getFkName('wishlist_item', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addIndex( - $installer->getIdxName('wishlist_item', 'store_id'), - 'store_id' - )->addForeignKey( - $installer->getFkName('wishlist_item', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Wishlist items' - ); - $installer->getConnection()->createTable($table); - - /** - * Create table 'wishlist_item_option' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable('wishlist_item_option') - )->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Option Id' - )->addColumn( - 'wishlist_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Wishlist Item Id' - )->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Product Id' - )->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Code' - )->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - ['nullable' => true], - 'Value' - )->addForeignKey( - $installer->getFkName('wishlist_item_option', 'wishlist_item_id', 'wishlist_item', 'wishlist_item_id'), - 'wishlist_item_id', - $installer->getTable('wishlist_item'), - 'wishlist_item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Wishlist Item Option Table' - ); - $installer->getConnection()->createTable($table); - - $installer->endSetup(); - - } + /** + * {@inheritdoc} + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + + $installer->startSetup(); + + /** + * Create table 'wishlist' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('wishlist') + )->addColumn( + 'wishlist_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Wishlist ID' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer ID' + )->addColumn( + 'shared', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sharing flag (0 or 1)' + )->addColumn( + 'sharing_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + [], + 'Sharing encrypted code' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Last updated date' + )->addIndex( + $installer->getIdxName('wishlist', 'shared'), + 'shared' + )->addIndex( + $installer->getIdxName('wishlist', + 'customer_id', + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + 'customer_id', + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('wishlist', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Wishlist main Table' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'wishlist_item' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('wishlist_item') + )->addColumn( + 'wishlist_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Wishlist item ID' + )->addColumn( + 'wishlist_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Wishlist ID' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => true], + 'Store ID' + )->addColumn( + 'added_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Add date and time' + )->addColumn( + 'description', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Short description of wish list item' + )->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false], + 'Qty' + )->addIndex( + $installer->getIdxName('wishlist_item', 'wishlist_id'), + 'wishlist_id' + )->addForeignKey( + $installer->getFkName('wishlist_item', 'wishlist_id', 'wishlist', 'wishlist_id'), + 'wishlist_id', + $installer->getTable('wishlist'), + 'wishlist_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addIndex( + $installer->getIdxName('wishlist_item', 'product_id'), + 'product_id' + )->addForeignKey( + $installer->getFkName('wishlist_item', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->addIndex( + $installer->getIdxName('wishlist_item', 'store_id'), + 'store_id' + )->addForeignKey( + $installer->getFkName('wishlist_item', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Wishlist items' + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'wishlist_item_option' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('wishlist_item_option') + )->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Id' + )->addColumn( + 'wishlist_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Wishlist Item Id' + )->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false], + 'Product Id' + )->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Code' + )->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + ['nullable' => true], + 'Value' + )->addForeignKey( + $installer->getFkName('wishlist_item_option', 'wishlist_item_id', 'wishlist_item', 'wishlist_item_id'), + 'wishlist_item_id', + $installer->getTable('wishlist_item'), + 'wishlist_item_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Wishlist Item Option Table' + ); + $installer->getConnection()->createTable($table); + + $installer->endSetup(); + + } } \ No newline at end of file From c5a7c7082461f42f65215a47bb6cadaf60619ff8 Mon Sep 17 00:00:00 2001 From: Maddy Chellathurai Date: Wed, 18 Feb 2015 11:11:25 -0600 Subject: [PATCH 051/106] MAGETWO-33889: Convert CE schema and data scripts to SPI classes - phpcs to InstallData scripts --- app/code/Magento/Cms/Setup/InstallData.php | 20 +++++++++---------- app/code/Magento/Eav/Setup/InstallData.php | 2 +- .../GroupedProduct/Setup/InstallData.php | 2 +- .../Magento/Reports/Setup/InstallData.php | 2 ++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Cms/Setup/InstallData.php b/app/code/Magento/Cms/Setup/InstallData.php index 4da4e6474c82d..8039768ca4c2e 100644 --- a/app/code/Magento/Cms/Setup/InstallData.php +++ b/app/code/Magento/Cms/Setup/InstallData.php @@ -86,8 +86,8 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface

- This privacy policy sets out how {{config path="general/store_information/name"}} uses and protects any information - that you give {{config path="general/store_information/name"}} when you use this website. + This privacy policy sets out how {{config path="general/store_information/name"}} uses and protects any + information that you give {{config path="general/store_information/name"}} when you use this website. {{config path="general/store_information/name"}} is committed to ensuring that your privacy is protected. Should we ask you to provide certain information by which you can be identified when using this website, then you can be assured that it will only be used in accordance with this privacy statement. @@ -125,9 +125,9 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface

Security

- We are committed to ensuring that your information is secure. In order to prevent unauthorised access or disclosure, - we have put in place suitable physical, electronic and managerial procedures to safeguard and secure - the information we collect online. + We are committed to ensuring that your information is secure. In order to prevent unauthorised access or + disclosure, we have put in place suitable physical, electronic and managerial procedures to safeguard and + secure the information we collect online.

How we use cookies

@@ -138,13 +138,13 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface your preferences.

- We use traffic log cookies to identify which pages are being used. This helps us analyse data about web page traffic - and improve our website in order to tailor it to customer needs. We only use this information for statistical - analysis purposes and then the data is removed from the system. + We use traffic log cookies to identify which pages are being used. This helps us analyse data about web page + traffic and improve our website in order to tailor it to customer needs. We only use this information for + statistical analysis purposes and then the data is removed from the system.

- Overall, cookies help us provide you with a better website, by enabling us to monitor which pages you find useful - and which you do not. A cookie in no way gives us access to your computer or any information about you, + Overall, cookies help us provide you with a better website, by enabling us to monitor which pages you find + useful and which you do not. A cookie in no way gives us access to your computer or any information about you, other than the data you choose to share with us. You can choose to accept or decline cookies. Most web browsers automatically accept cookies, but you can usually modify your browser setting to decline cookies if you prefer. This may prevent you from taking full advantage of the website. diff --git a/app/code/Magento/Eav/Setup/InstallData.php b/app/code/Magento/Eav/Setup/InstallData.php index da79960e57bf1..c9ec50855bdbf 100644 --- a/app/code/Magento/Eav/Setup/InstallData.php +++ b/app/code/Magento/Eav/Setup/InstallData.php @@ -10,7 +10,7 @@ use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; -class InstallData implements InstallDataInterface +class InstallData implements InstallDataInterface { /** * EAV setup factory diff --git a/app/code/Magento/GroupedProduct/Setup/InstallData.php b/app/code/Magento/GroupedProduct/Setup/InstallData.php index 16786e43a047b..b3227d91f6d83 100644 --- a/app/code/Magento/GroupedProduct/Setup/InstallData.php +++ b/app/code/Magento/GroupedProduct/Setup/InstallData.php @@ -12,7 +12,7 @@ use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; -class InstallData implements InstallDataInterface +class InstallData implements InstallDataInterface { /** * @var EavSetupFactory diff --git a/app/code/Magento/Reports/Setup/InstallData.php b/app/code/Magento/Reports/Setup/InstallData.php index 65fb98e8d10bd..735b87612ecd1 100644 --- a/app/code/Magento/Reports/Setup/InstallData.php +++ b/app/code/Magento/Reports/Setup/InstallData.php @@ -6,6 +6,8 @@ */ namespace Magento\Reports\Setup; +// @codingStandardsIgnoreFile + use Magento\Cms\Model\PageFactory; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; From 2e8df856937cf5730461e53e5b31aa3c24e6e32d Mon Sep 17 00:00:00 2001 From: Maddy Chellathurai Date: Wed, 18 Feb 2015 11:41:31 -0600 Subject: [PATCH 052/106] MAGETWO-33889: Convert CE schema and data scripts to SPI classes - CR fix --- app/code/Magento/Catalog/Setup/UpgradeSchema.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index 87b2c4965314f..10f003e68bc47 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -16,7 +16,7 @@ class UpgradeSchema implements UpgradeSchemaInterface */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { - if (version_compare($context->getVersion(), '2.0.0.1') <= 0) { + if (version_compare($context->getVersion(), '2.0.0.1') < 0) { $installer = $setup; $installer->startSetup(); From 98b4e2a1f7b91de4ed62da993d9cd54ab6f1e392 Mon Sep 17 00:00:00 2001 From: Maddy Chellathurai Date: Wed, 18 Feb 2015 11:43:07 -0600 Subject: [PATCH 053/106] MAGETWO-33889: Convert CE schema and data scripts to SPI classes - CR fixes. --- app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php | 2 +- app/code/Magento/Customer/Setup/UpgradeSchema.php | 2 +- app/code/Magento/Sales/Setup/UpgradeSchema.php | 2 +- app/code/Magento/Theme/Setup/UpgradeSchema.php | 2 +- app/code/Magento/Weee/Setup/UpgradeSchema.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php index 2b10dbb69ec9a..76e6eb66c59e7 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php +++ b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php @@ -16,7 +16,7 @@ class UpgradeSchema implements UpgradeSchemaInterface */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { - if (version_compare($context->getVersion(), '2.0.1') <= 0) { + if (version_compare($context->getVersion(), '2.0.1') < 0) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Customer/Setup/UpgradeSchema.php b/app/code/Magento/Customer/Setup/UpgradeSchema.php index 6fd309092af77..6eb28da9a84aa 100644 --- a/app/code/Magento/Customer/Setup/UpgradeSchema.php +++ b/app/code/Magento/Customer/Setup/UpgradeSchema.php @@ -17,7 +17,7 @@ class UpgradeSchema implements UpgradeSchemaInterface */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { - if (version_compare($context->getVersion(), '2.0.0.1') <= 0) { + if (version_compare($context->getVersion(), '2.0.0.1') < 0) { $installer = $setup; $installer->startSetup(); $connection = $installer->getConnection(); diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php index d9aaa6805cf49..236e21988c973 100644 --- a/app/code/Magento/Sales/Setup/UpgradeSchema.php +++ b/app/code/Magento/Sales/Setup/UpgradeSchema.php @@ -17,7 +17,7 @@ class UpgradeSchema implements UpgradeSchemaInterface */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { - if (version_compare($context->getVersion(), '2.0.1') <= 0) { + if (version_compare($context->getVersion(), '2.0.1') < 0) { $installer = $setup; diff --git a/app/code/Magento/Theme/Setup/UpgradeSchema.php b/app/code/Magento/Theme/Setup/UpgradeSchema.php index cac403af3b558..befb5e6ad1d54 100644 --- a/app/code/Magento/Theme/Setup/UpgradeSchema.php +++ b/app/code/Magento/Theme/Setup/UpgradeSchema.php @@ -16,7 +16,7 @@ class UpgradeSchema implements UpgradeSchemaInterface */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { - if (version_compare($context->getVersion(), '2.0.1') <= 0) { + if (version_compare($context->getVersion(), '2.0.1') < 0) { $installer = $setup; $installer->startSetup(); diff --git a/app/code/Magento/Weee/Setup/UpgradeSchema.php b/app/code/Magento/Weee/Setup/UpgradeSchema.php index f092ae4c8b075..adaab08c6b966 100644 --- a/app/code/Magento/Weee/Setup/UpgradeSchema.php +++ b/app/code/Magento/Weee/Setup/UpgradeSchema.php @@ -16,7 +16,7 @@ class UpgradeSchema implements UpgradeSchemaInterface */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { - if (version_compare($context->getVersion(), '2.0.0.1') <= 0) { + if (version_compare($context->getVersion(), '2.0.0.1') < 0) { $setup->startSetup(); $connection = $setup->getConnection(); From 29f70a97c5611b8b80083f486fde14cae72d76af Mon Sep 17 00:00:00 2001 From: Maddy Chellathurai Date: Wed, 18 Feb 2015 12:26:53 -0600 Subject: [PATCH 054/106] MAGETWO-33889: Convert CE schema and data scripts to SPI classes - Adding spaces before namespace --- app/code/Magento/Authorization/Setup/InstallData.php | 1 + app/code/Magento/Authorization/Setup/InstallSchema.php | 1 + app/code/Magento/Bundle/Setup/InstallData.php | 1 + app/code/Magento/Bundle/Setup/InstallSchema.php | 1 + app/code/Magento/Captcha/Setup/InstallSchema.php | 1 + app/code/Magento/Catalog/Setup/InstallData.php | 1 + app/code/Magento/Catalog/Setup/InstallSchema.php | 1 + app/code/Magento/Catalog/Setup/UpgradeSchema.php | 1 + app/code/Magento/CatalogInventory/Setup/InstallData.php | 1 + app/code/Magento/CatalogInventory/Setup/InstallSchema.php | 1 + app/code/Magento/CatalogRule/Setup/InstallSchema.php | 1 + app/code/Magento/CatalogSearch/Setup/InstallSchema.php | 1 + app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php | 1 + app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php | 1 + app/code/Magento/Checkout/Setup/InstallData.php | 1 + app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php | 1 + app/code/Magento/Cms/Setup/InstallData.php | 1 + app/code/Magento/Cms/Setup/InstallSchema.php | 1 + app/code/Magento/ConfigurableProduct/Setup/InstallData.php | 1 + app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php | 1 + app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php | 1 + app/code/Magento/Core/Setup/InstallSchema.php | 1 + app/code/Magento/Cron/Setup/InstallSchema.php | 1 + app/code/Magento/DesignEditor/Setup/InstallSchema.php | 1 + app/code/Magento/Dhl/Setup/InstallData.php | 1 + app/code/Magento/Directory/Setup/InstallSchema.php | 1 + app/code/Magento/Downloadable/Setup/InstallData.php | 1 + app/code/Magento/Downloadable/Setup/InstallSchema.php | 1 + app/code/Magento/Eav/Setup/InstallData.php | 1 + app/code/Magento/Eav/Setup/InstallSchema.php | 1 + app/code/Magento/Email/Setup/InstallSchema.php | 1 + app/code/Magento/GiftMessage/Setup/InstallData.php | 1 + app/code/Magento/GiftMessage/Setup/InstallSchema.php | 1 + app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php | 1 + app/code/Magento/GoogleShopping/Setup/InstallSchema.php | 1 + app/code/Magento/GroupedProduct/Setup/InstallData.php | 1 + app/code/Magento/ImportExport/Setup/InstallSchema.php | 1 + app/code/Magento/Indexer/Setup/InstallSchema.php | 1 + app/code/Magento/Integration/Setup/InstallSchema.php | 1 + app/code/Magento/Log/Setup/InstallSchema.php | 1 + app/code/Magento/Msrp/Setup/InstallData.php | 1 + app/code/Magento/Newsletter/Setup/InstallSchema.php | 1 + app/code/Magento/OfflineShipping/Setup/InstallSchema.php | 1 + app/code/Magento/Persistent/Setup/InstallSchema.php | 1 + app/code/Magento/ProductAlert/Setup/InstallSchema.php | 1 + app/code/Magento/Quote/Setup/InstallData.php | 1 + app/code/Magento/Quote/Setup/InstallSchema.php | 1 + app/code/Magento/Reports/Setup/InstallData.php | 1 + app/code/Magento/Reports/Setup/InstallSchema.php | 1 + app/code/Magento/Review/Setup/InstallSchema.php | 1 + app/code/Magento/Sales/Setup/InstallData.php | 1 + app/code/Magento/Sales/Setup/InstallSchema.php | 1 + app/code/Magento/Sales/Setup/UpgradeSchema.php | 1 + app/code/Magento/SalesRule/Setup/InstallSchema.php | 1 + app/code/Magento/Search/Setup/InstallSchema.php | 1 + app/code/Magento/Sendfriend/Setup/InstallSchema.php | 1 + app/code/Magento/Sitemap/Setup/InstallSchema.php | 1 + app/code/Magento/Store/Setup/InstallSchema.php | 1 + app/code/Magento/Tax/Setup/InstallData.php | 1 + app/code/Magento/Tax/Setup/InstallSchema.php | 1 + app/code/Magento/Theme/Setup/InstallData.php | 1 + app/code/Magento/Theme/Setup/InstallSchema.php | 1 + app/code/Magento/Theme/Setup/UpgradeSchema.php | 1 + app/code/Magento/Translation/Setup/InstallSchema.php | 1 + app/code/Magento/UrlRewrite/Setup/InstallSchema.php | 1 + app/code/Magento/User/Setup/InstallSchema.php | 1 + app/code/Magento/Weee/Setup/InstallData.php | 1 + app/code/Magento/Weee/Setup/InstallSchema.php | 1 + app/code/Magento/Weee/Setup/UpgradeSchema.php | 1 + app/code/Magento/Widget/Setup/InstallSchema.php | 1 + app/code/Magento/Wishlist/Setup/InstallSchema.php | 1 + 71 files changed, 71 insertions(+) diff --git a/app/code/Magento/Authorization/Setup/InstallData.php b/app/code/Magento/Authorization/Setup/InstallData.php index 77ac516f6cded..97d85635b1755 100644 --- a/app/code/Magento/Authorization/Setup/InstallData.php +++ b/app/code/Magento/Authorization/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Authorization\Setup; use Magento\Framework\Setup\InstallDataInterface; diff --git a/app/code/Magento/Authorization/Setup/InstallSchema.php b/app/code/Magento/Authorization/Setup/InstallSchema.php index 4dce4c8970fdf..faa4442fccc16 100644 --- a/app/code/Magento/Authorization/Setup/InstallSchema.php +++ b/app/code/Magento/Authorization/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Authorization\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Bundle/Setup/InstallData.php b/app/code/Magento/Bundle/Setup/InstallData.php index 437bce73dd7fe..99bd54fccfcdd 100644 --- a/app/code/Magento/Bundle/Setup/InstallData.php +++ b/app/code/Magento/Bundle/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Bundle\Setup; use Magento\Eav\Setup\EavSetup; diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php index fedbefcfb3ced..b78d928a7c4df 100644 --- a/app/code/Magento/Bundle/Setup/InstallSchema.php +++ b/app/code/Magento/Bundle/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Bundle\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Captcha/Setup/InstallSchema.php b/app/code/Magento/Captcha/Setup/InstallSchema.php index b4da3f6cc9fb4..6ff912413a991 100644 --- a/app/code/Magento/Captcha/Setup/InstallSchema.php +++ b/app/code/Magento/Captcha/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Captcha\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Catalog/Setup/InstallData.php b/app/code/Magento/Catalog/Setup/InstallData.php index 25e7ba07a8b0b..7f57cc8cd1c09 100644 --- a/app/code/Magento/Catalog/Setup/InstallData.php +++ b/app/code/Magento/Catalog/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Setup; use Magento\Framework\Setup\InstallDataInterface; diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php index acf5e12f3ea6f..684058651384f 100644 --- a/app/code/Magento/Catalog/Setup/InstallSchema.php +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index 10f003e68bc47..6ac8155bd5d05 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; diff --git a/app/code/Magento/CatalogInventory/Setup/InstallData.php b/app/code/Magento/CatalogInventory/Setup/InstallData.php index 81dd4f3a98ecf..67119895729d9 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallData.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogInventory\Setup; use Magento\Eav\Setup\EavSetup; diff --git a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php index 406e6597638b9..f8d5bbef72b54 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogInventory\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/CatalogRule/Setup/InstallSchema.php b/app/code/Magento/CatalogRule/Setup/InstallSchema.php index 26ef4f07b7ede..ee5b7813879bd 100644 --- a/app/code/Magento/CatalogRule/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogRule/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogRule\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php index 04281b9a0e572..c9e1591987b14 100644 --- a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogSearch\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php index aac82dd0b6aa0..de3d3f0fa5ef2 100644 --- a/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogUrlRewrite\Setup; use Magento\Eav\Setup\EavSetup; diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php index 2c5d520867b1b..0fe0398d73f29 100644 --- a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogUrlRewrite\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Checkout/Setup/InstallData.php b/app/code/Magento/Checkout/Setup/InstallData.php index 789bc7573270d..be0503c02927b 100644 --- a/app/code/Magento/Checkout/Setup/InstallData.php +++ b/app/code/Magento/Checkout/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Setup; use Magento\Customer\Helper\Address; diff --git a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php index dc81a8205e247..da024ee5e4e35 100644 --- a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php +++ b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CheckoutAgreements\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Cms/Setup/InstallData.php b/app/code/Magento/Cms/Setup/InstallData.php index 8039768ca4c2e..d4360db5a8c20 100644 --- a/app/code/Magento/Cms/Setup/InstallData.php +++ b/app/code/Magento/Cms/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Cms\Setup; use Magento\Cms\Model\Page; diff --git a/app/code/Magento/Cms/Setup/InstallSchema.php b/app/code/Magento/Cms/Setup/InstallSchema.php index 6aab12de25ae7..ded7602b981b8 100644 --- a/app/code/Magento/Cms/Setup/InstallSchema.php +++ b/app/code/Magento/Cms/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Cms\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php index ad02c12904807..cc890332b15af 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ConfigurableProduct\Setup; use Magento\ConfigurableProduct\Model\Product\Type\Configurable; diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php index d9eb17cff25ab..719c37836cf6d 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ConfigurableProduct\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php index 76e6eb66c59e7..ad22b61b4b9de 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php +++ b/app/code/Magento/ConfigurableProduct/Setup/UpgradeSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ConfigurableProduct\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; diff --git a/app/code/Magento/Core/Setup/InstallSchema.php b/app/code/Magento/Core/Setup/InstallSchema.php index a745c183a23f2..436230e1cd439 100644 --- a/app/code/Magento/Core/Setup/InstallSchema.php +++ b/app/code/Magento/Core/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Core\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Cron/Setup/InstallSchema.php b/app/code/Magento/Cron/Setup/InstallSchema.php index e496810e84809..ef6331fdf965e 100644 --- a/app/code/Magento/Cron/Setup/InstallSchema.php +++ b/app/code/Magento/Cron/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Cron\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/DesignEditor/Setup/InstallSchema.php b/app/code/Magento/DesignEditor/Setup/InstallSchema.php index 154b91e486d15..bd54b2b6867cc 100644 --- a/app/code/Magento/DesignEditor/Setup/InstallSchema.php +++ b/app/code/Magento/DesignEditor/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\DesignEditor\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Dhl/Setup/InstallData.php b/app/code/Magento/Dhl/Setup/InstallData.php index 4917a3f8ae8c5..851ae66221cd8 100644 --- a/app/code/Magento/Dhl/Setup/InstallData.php +++ b/app/code/Magento/Dhl/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Dhl\Setup; use Magento\Framework\Locale\ListsInterface; diff --git a/app/code/Magento/Directory/Setup/InstallSchema.php b/app/code/Magento/Directory/Setup/InstallSchema.php index 9c1b2f604ed4e..0accc7584d9fb 100644 --- a/app/code/Magento/Directory/Setup/InstallSchema.php +++ b/app/code/Magento/Directory/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Directory\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Downloadable/Setup/InstallData.php b/app/code/Magento/Downloadable/Setup/InstallData.php index 5a4e8b61a559c..de6fa64a4d753 100644 --- a/app/code/Magento/Downloadable/Setup/InstallData.php +++ b/app/code/Magento/Downloadable/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Downloadable\Setup; use Magento\Eav\Setup\EavSetup; diff --git a/app/code/Magento/Downloadable/Setup/InstallSchema.php b/app/code/Magento/Downloadable/Setup/InstallSchema.php index 2befaff02d9f7..9f90fb1ad0404 100644 --- a/app/code/Magento/Downloadable/Setup/InstallSchema.php +++ b/app/code/Magento/Downloadable/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Downloadable\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Eav/Setup/InstallData.php b/app/code/Magento/Eav/Setup/InstallData.php index c9ec50855bdbf..7e222bc847272 100644 --- a/app/code/Magento/Eav/Setup/InstallData.php +++ b/app/code/Magento/Eav/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Setup; use Magento\Eav\Setup\EavSetupFactory; diff --git a/app/code/Magento/Eav/Setup/InstallSchema.php b/app/code/Magento/Eav/Setup/InstallSchema.php index 68ec4e4b10f8e..2d305a99a2ca3 100644 --- a/app/code/Magento/Eav/Setup/InstallSchema.php +++ b/app/code/Magento/Eav/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Email/Setup/InstallSchema.php b/app/code/Magento/Email/Setup/InstallSchema.php index 60b315057d10e..7d53a0e6af721 100644 --- a/app/code/Magento/Email/Setup/InstallSchema.php +++ b/app/code/Magento/Email/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Email\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/GiftMessage/Setup/InstallData.php b/app/code/Magento/GiftMessage/Setup/InstallData.php index 69160be0eea3e..29c25a14c98e5 100644 --- a/app/code/Magento/GiftMessage/Setup/InstallData.php +++ b/app/code/Magento/GiftMessage/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GiftMessage\Setup; use Magento\Catalog\Setup\CategorySetupFactory; diff --git a/app/code/Magento/GiftMessage/Setup/InstallSchema.php b/app/code/Magento/GiftMessage/Setup/InstallSchema.php index e73c25fff6a47..82244f7eedc19 100644 --- a/app/code/Magento/GiftMessage/Setup/InstallSchema.php +++ b/app/code/Magento/GiftMessage/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GiftMessage\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php index 25bec445bf7bf..a59bd9521ea54 100644 --- a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php +++ b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GoogleOptimizer\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/GoogleShopping/Setup/InstallSchema.php b/app/code/Magento/GoogleShopping/Setup/InstallSchema.php index 034391e7bf501..399437cbf7a11 100644 --- a/app/code/Magento/GoogleShopping/Setup/InstallSchema.php +++ b/app/code/Magento/GoogleShopping/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GoogleShopping\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/GroupedProduct/Setup/InstallData.php b/app/code/Magento/GroupedProduct/Setup/InstallData.php index b3227d91f6d83..169fbb5ddf39f 100644 --- a/app/code/Magento/GroupedProduct/Setup/InstallData.php +++ b/app/code/Magento/GroupedProduct/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GroupedProduct\Setup; use Magento\Catalog\Model\Product; diff --git a/app/code/Magento/ImportExport/Setup/InstallSchema.php b/app/code/Magento/ImportExport/Setup/InstallSchema.php index d2c3cc3dee8d5..898bc4feb0961 100644 --- a/app/code/Magento/ImportExport/Setup/InstallSchema.php +++ b/app/code/Magento/ImportExport/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ImportExport\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Indexer/Setup/InstallSchema.php b/app/code/Magento/Indexer/Setup/InstallSchema.php index 063fedf86d1b2..7e2ae13be91cc 100644 --- a/app/code/Magento/Indexer/Setup/InstallSchema.php +++ b/app/code/Magento/Indexer/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Indexer\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Integration/Setup/InstallSchema.php b/app/code/Magento/Integration/Setup/InstallSchema.php index 9a58b14c465a0..80deea5ffa9e1 100644 --- a/app/code/Magento/Integration/Setup/InstallSchema.php +++ b/app/code/Magento/Integration/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Integration\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Log/Setup/InstallSchema.php b/app/code/Magento/Log/Setup/InstallSchema.php index e9efbd9eacb15..8bcb0d4f4fdae 100644 --- a/app/code/Magento/Log/Setup/InstallSchema.php +++ b/app/code/Magento/Log/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Log\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Msrp/Setup/InstallData.php b/app/code/Magento/Msrp/Setup/InstallData.php index cc014f4118730..ffaeded8aadc9 100644 --- a/app/code/Magento/Msrp/Setup/InstallData.php +++ b/app/code/Magento/Msrp/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Msrp\Setup; use Magento\Eav\Setup\EavSetup; diff --git a/app/code/Magento/Newsletter/Setup/InstallSchema.php b/app/code/Magento/Newsletter/Setup/InstallSchema.php index e0f8d102552b2..9c2efb09098f7 100644 --- a/app/code/Magento/Newsletter/Setup/InstallSchema.php +++ b/app/code/Magento/Newsletter/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Newsletter\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/OfflineShipping/Setup/InstallSchema.php b/app/code/Magento/OfflineShipping/Setup/InstallSchema.php index 595a98615cdd6..401277821b588 100644 --- a/app/code/Magento/OfflineShipping/Setup/InstallSchema.php +++ b/app/code/Magento/OfflineShipping/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\OfflineShipping\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Persistent/Setup/InstallSchema.php b/app/code/Magento/Persistent/Setup/InstallSchema.php index e7bf541619798..7622fa0afaa34 100644 --- a/app/code/Magento/Persistent/Setup/InstallSchema.php +++ b/app/code/Magento/Persistent/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Persistent\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/ProductAlert/Setup/InstallSchema.php b/app/code/Magento/ProductAlert/Setup/InstallSchema.php index 6fd68b04c8f38..f500254f2939e 100644 --- a/app/code/Magento/ProductAlert/Setup/InstallSchema.php +++ b/app/code/Magento/ProductAlert/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ProductAlert\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Quote/Setup/InstallData.php b/app/code/Magento/Quote/Setup/InstallData.php index ebe933d4b2d8a..c64adbd6ab8f9 100644 --- a/app/code/Magento/Quote/Setup/InstallData.php +++ b/app/code/Magento/Quote/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Setup; use Magento\Framework\DB\Ddl\Table; diff --git a/app/code/Magento/Quote/Setup/InstallSchema.php b/app/code/Magento/Quote/Setup/InstallSchema.php index 4c16eede4f252..4962c03ddd613 100644 --- a/app/code/Magento/Quote/Setup/InstallSchema.php +++ b/app/code/Magento/Quote/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Reports/Setup/InstallData.php b/app/code/Magento/Reports/Setup/InstallData.php index 735b87612ecd1..5e844ee926ca9 100644 --- a/app/code/Magento/Reports/Setup/InstallData.php +++ b/app/code/Magento/Reports/Setup/InstallData.php @@ -4,6 +4,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Reports\Setup; // @codingStandardsIgnoreFile diff --git a/app/code/Magento/Reports/Setup/InstallSchema.php b/app/code/Magento/Reports/Setup/InstallSchema.php index d2bfde242736e..1fb639b0ad301 100644 --- a/app/code/Magento/Reports/Setup/InstallSchema.php +++ b/app/code/Magento/Reports/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Reports\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Review/Setup/InstallSchema.php b/app/code/Magento/Review/Setup/InstallSchema.php index 8b79e04f69349..470adc3709a53 100644 --- a/app/code/Magento/Review/Setup/InstallSchema.php +++ b/app/code/Magento/Review/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Review\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Sales/Setup/InstallData.php b/app/code/Magento/Sales/Setup/InstallData.php index cf11872833d0a..c85808689feb9 100644 --- a/app/code/Magento/Sales/Setup/InstallData.php +++ b/app/code/Magento/Sales/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Setup; use Magento\Framework\Setup\InstallDataInterface; diff --git a/app/code/Magento/Sales/Setup/InstallSchema.php b/app/code/Magento/Sales/Setup/InstallSchema.php index 35906a79d3874..5d9310d27dd9f 100644 --- a/app/code/Magento/Sales/Setup/InstallSchema.php +++ b/app/code/Magento/Sales/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php index 236e21988c973..ae1ccf6aa61c5 100644 --- a/app/code/Magento/Sales/Setup/UpgradeSchema.php +++ b/app/code/Magento/Sales/Setup/UpgradeSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Setup; use Magento\Framework\DB\Ddl\Table; diff --git a/app/code/Magento/SalesRule/Setup/InstallSchema.php b/app/code/Magento/SalesRule/Setup/InstallSchema.php index 3a5ab1eab990c..7bf34def357df 100644 --- a/app/code/Magento/SalesRule/Setup/InstallSchema.php +++ b/app/code/Magento/SalesRule/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\SalesRule\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Search/Setup/InstallSchema.php b/app/code/Magento/Search/Setup/InstallSchema.php index 037355ddc12de..a8a156a3ae797 100644 --- a/app/code/Magento/Search/Setup/InstallSchema.php +++ b/app/code/Magento/Search/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Search\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Sendfriend/Setup/InstallSchema.php b/app/code/Magento/Sendfriend/Setup/InstallSchema.php index c8a68c2f9fbe1..9d622b1e39704 100644 --- a/app/code/Magento/Sendfriend/Setup/InstallSchema.php +++ b/app/code/Magento/Sendfriend/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sendfriend\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Sitemap/Setup/InstallSchema.php b/app/code/Magento/Sitemap/Setup/InstallSchema.php index 008539ac1f52d..a8b34f1158ae8 100644 --- a/app/code/Magento/Sitemap/Setup/InstallSchema.php +++ b/app/code/Magento/Sitemap/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sitemap\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Store/Setup/InstallSchema.php b/app/code/Magento/Store/Setup/InstallSchema.php index 4ea6234e3e25e..e6b555bd92819 100644 --- a/app/code/Magento/Store/Setup/InstallSchema.php +++ b/app/code/Magento/Store/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Tax/Setup/InstallData.php b/app/code/Magento/Tax/Setup/InstallData.php index c3485e73e978f..a422e2fc11ea7 100644 --- a/app/code/Magento/Tax/Setup/InstallData.php +++ b/app/code/Magento/Tax/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Tax\Setup; use Magento\Framework\Setup\InstallDataInterface; diff --git a/app/code/Magento/Tax/Setup/InstallSchema.php b/app/code/Magento/Tax/Setup/InstallSchema.php index 8ae4526cf7ece..5ecb74835e9a6 100644 --- a/app/code/Magento/Tax/Setup/InstallSchema.php +++ b/app/code/Magento/Tax/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Tax\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Theme/Setup/InstallData.php b/app/code/Magento/Theme/Setup/InstallData.php index eb2442680c0ef..1c459da4271d1 100644 --- a/app/code/Magento/Theme/Setup/InstallData.php +++ b/app/code/Magento/Theme/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Setup; use Magento\Framework\Setup\InstallDataInterface; diff --git a/app/code/Magento/Theme/Setup/InstallSchema.php b/app/code/Magento/Theme/Setup/InstallSchema.php index 9faeb3bc17671..ad10832e92b41 100644 --- a/app/code/Magento/Theme/Setup/InstallSchema.php +++ b/app/code/Magento/Theme/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Theme/Setup/UpgradeSchema.php b/app/code/Magento/Theme/Setup/UpgradeSchema.php index befb5e6ad1d54..fd45ebf4b9405 100644 --- a/app/code/Magento/Theme/Setup/UpgradeSchema.php +++ b/app/code/Magento/Theme/Setup/UpgradeSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; diff --git a/app/code/Magento/Translation/Setup/InstallSchema.php b/app/code/Magento/Translation/Setup/InstallSchema.php index fd106cba2bc39..3c80fe78b9f37 100644 --- a/app/code/Magento/Translation/Setup/InstallSchema.php +++ b/app/code/Magento/Translation/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Translation\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/UrlRewrite/Setup/InstallSchema.php b/app/code/Magento/UrlRewrite/Setup/InstallSchema.php index d6987ea148a53..8b3415f2160bf 100644 --- a/app/code/Magento/UrlRewrite/Setup/InstallSchema.php +++ b/app/code/Magento/UrlRewrite/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\UrlRewrite\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/User/Setup/InstallSchema.php b/app/code/Magento/User/Setup/InstallSchema.php index a2041a4a3dd52..540db66725885 100644 --- a/app/code/Magento/User/Setup/InstallSchema.php +++ b/app/code/Magento/User/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\User\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Weee/Setup/InstallData.php b/app/code/Magento/Weee/Setup/InstallData.php index f548199838c1f..22de4fb721c8f 100644 --- a/app/code/Magento/Weee/Setup/InstallData.php +++ b/app/code/Magento/Weee/Setup/InstallData.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Weee\Setup; use Magento\Framework\Setup\InstallDataInterface; diff --git a/app/code/Magento/Weee/Setup/InstallSchema.php b/app/code/Magento/Weee/Setup/InstallSchema.php index 1ac0954fdec4a..e2d6a56456d25 100644 --- a/app/code/Magento/Weee/Setup/InstallSchema.php +++ b/app/code/Magento/Weee/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Weee\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Weee/Setup/UpgradeSchema.php b/app/code/Magento/Weee/Setup/UpgradeSchema.php index adaab08c6b966..9d4feeb5cbf02 100644 --- a/app/code/Magento/Weee/Setup/UpgradeSchema.php +++ b/app/code/Magento/Weee/Setup/UpgradeSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Weee\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; diff --git a/app/code/Magento/Widget/Setup/InstallSchema.php b/app/code/Magento/Widget/Setup/InstallSchema.php index d2ee20718faa2..d014535daa6e1 100644 --- a/app/code/Magento/Widget/Setup/InstallSchema.php +++ b/app/code/Magento/Widget/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Widget\Setup; use Magento\Framework\Setup\InstallSchemaInterface; diff --git a/app/code/Magento/Wishlist/Setup/InstallSchema.php b/app/code/Magento/Wishlist/Setup/InstallSchema.php index 6ca08c8c95d1d..8533938bb9210 100644 --- a/app/code/Magento/Wishlist/Setup/InstallSchema.php +++ b/app/code/Magento/Wishlist/Setup/InstallSchema.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Wishlist\Setup; use Magento\Framework\Setup\InstallSchemaInterface; From 08adf60feebf5f7d6171053994d9f183e327a23e Mon Sep 17 00:00:00 2001 From: Safwan Khan Date: Wed, 18 Feb 2015 15:05:46 -0600 Subject: [PATCH 055/106] MAGETWO-33888: Change setup framework to use SPI classes - Changes to use Recurring.php. --- .../Magento/Setup/Model/InstallerTest.php | 17 ++++++++++------- .../ModuleInstallerUpgraderFactoryTest.php | 10 ++++++++++ .../Module/_files/Foo/One/Setup/Recurring.php | 5 +++++ .../Magento/Framework/Module/Updater.php | 3 ++- setup/src/Magento/Setup/Model/Installer.php | 18 ++++++++++++++++-- .../Module/ModuleInstallerUpgraderFactory.php | 14 ++++++++++++++ 6 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 dev/tests/unit/testsuite/Magento/Setup/Module/_files/Foo/One/Setup/Recurring.php diff --git a/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php b/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php index 8e112960a3406..4756378de2f59 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php @@ -241,13 +241,16 @@ public function testInstall() $this->logger->expects($this->at(7))->method('log')->with('Installing database schema:'); $this->logger->expects($this->at(9))->method('log')->with("Module 'Foo_One':"); $this->logger->expects($this->at(11))->method('log')->with("Module 'Bar_Two':"); - $this->logger->expects($this->at(14))->method('log')->with('Installing user configuration...'); - $this->logger->expects($this->at(16))->method('log')->with('Installing data...'); - $this->logger->expects($this->at(18))->method('log')->with('Installing admin user...'); - $this->logger->expects($this->at(20))->method('log')->with('Enabling caches:'); - $this->logger->expects($this->at(21))->method('log')->with('Current status:'); - $this->logger->expects($this->at(24))->method('log')->with('Disabling Maintenance Mode:'); - $this->logger->expects($this->at(26))->method('log')->with('Post installation file permissions check...'); + $this->logger->expects($this->at(13))->method('log')->with('Schema post-updates:'); + $this->logger->expects($this->at(14))->method('log')->with("Module 'Foo_One':"); + $this->logger->expects($this->at(15))->method('log')->with("Module 'Bar_Two':"); + $this->logger->expects($this->at(17))->method('log')->with('Installing user configuration...'); + $this->logger->expects($this->at(19))->method('log')->with('Installing data...'); + $this->logger->expects($this->at(21))->method('log')->with('Installing admin user...'); + $this->logger->expects($this->at(23))->method('log')->with('Enabling caches:'); + $this->logger->expects($this->at(24))->method('log')->with('Current status:'); + $this->logger->expects($this->at(27))->method('log')->with('Disabling Maintenance Mode:'); + $this->logger->expects($this->at(29))->method('log')->with('Post installation file permissions check...'); $this->logger->expects($this->once())->method('logSuccess')->with('Magento installation complete.'); $this->object->install($request); } diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/ModuleInstallerUpgraderFactoryTest.php b/dev/tests/unit/testsuite/Magento/Setup/Module/ModuleInstallerUpgraderFactoryTest.php index 63a7cc070f723..999a6542729a2 100644 --- a/dev/tests/unit/testsuite/Magento/Setup/Module/ModuleInstallerUpgraderFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Setup/Module/ModuleInstallerUpgraderFactoryTest.php @@ -24,6 +24,10 @@ protected function setUp() 'Bar\Two\Setup\UpgradeSchema', $this->getMockForAbstractClass('Magento\Framework\Setup\UpgradeSchemaInterface'), ], + [ + 'Foo\One\Setup\Recurring', + $this->getMockForAbstractClass('Magento\Framework\Setup\InstallSchemaInterface'), + ], ]; $serviceLocatorMock = $this->getMockForAbstractClass('Zend\ServiceManager\ServiceLocatorInterface', ['get']); @@ -53,4 +57,10 @@ public function testCreateSchemaUpgrader() $upgrader = $this->moduleInstallerUpgraderFactory->createSchemaUpgrader('Bar_Two'); $this->assertInstanceOf('Magento\Framework\Setup\UpgradeSchemaInterface', $upgrader); } + + public function testCreateRecurringUpgrader() + { + $installer = $this->moduleInstallerUpgraderFactory->createRecurringUpgrader('Foo_One'); + $this->assertInstanceOf('Magento\Framework\Setup\InstallSchemaInterface', $installer); + } } \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Foo/One/Setup/Recurring.php b/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Foo/One/Setup/Recurring.php new file mode 100644 index 0000000000000..da576e1679422 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Setup/Module/_files/Foo/One/Setup/Recurring.php @@ -0,0 +1,5 @@ +getDataVersion($moduleName); $moduleConfig = $this->_moduleList->getOne($moduleName); $configVer = $moduleConfig['setup_version']; - $moduleContext = new \Magento\Setup\Model\ModuleContext($dataVer); if ($dataVer !== false) { $status = version_compare($configVer, $dataVer); if ($status == \Magento\Framework\Setup\ModuleDataSetupInterface::VERSION_COMPARE_GREATER) { + $moduleContext = new \Magento\Setup\Model\ModuleContext($dataVer); $moduleUpgrader = $this->setupFactory->create($moduleName, 'upgrade'); if ($moduleUpgrader) { $moduleUpgrader->upgrade($this->dataSetup, $moduleContext); @@ -73,6 +73,7 @@ public function updateData($resource) } } } elseif ($configVer) { + $moduleContext = new \Magento\Setup\Model\ModuleContext(''); $moduleInstaller = $this->setupFactory->create($moduleName, 'install'); if ($moduleInstaller) { $moduleInstaller->install($this->dataSetup, $moduleContext); diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index e9e306af51505..e7f7c948e5cb1 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -606,16 +606,18 @@ public function installSchema() $this->assertDbAccessible(); $this->setupModuleRegistry(); + $moduleNames = $this->moduleList->getNames(); + $this->log->log('Schema creation/updates:'); - foreach ($this->moduleList->getNames() as $moduleName) { + foreach ($moduleNames as $moduleName) { $this->log->log("Module '{$moduleName}':"); $dbVer = $this->resource->getDbVersion($moduleName); $moduleConfig = $this->moduleList->getOne($moduleName); $configVer = $moduleConfig['setup_version']; - $moduleContext = new ModuleContext($moduleConfig); // Module is installed if ($dbVer !== false) { if (version_compare($configVer, $dbVer, '>')) { + $moduleContext = new ModuleContext($dbVer); $moduleUpgrader = $this->moduleInstallerUpgraderFactory->createSchemaUpgrader($moduleName); if ($moduleUpgrader) { $moduleUpgrader->upgrade($this->setup, $moduleContext); @@ -623,6 +625,7 @@ public function installSchema() } } } elseif ($configVer) { + $moduleContext = new ModuleContext(''); $moduleInstaller = $this->moduleInstallerUpgraderFactory->createSchemaInstaller($moduleName); if ($moduleInstaller) { $moduleInstaller->install($this->setup, $moduleContext); @@ -631,6 +634,17 @@ public function installSchema() } $this->logProgress(); } + + $this->log->log('Schema post-updates:'); + foreach ($moduleNames as $moduleName) { + $this->log->log("Module '{$moduleName}':"); + $dbVer = $this->resource->getDbVersion($moduleName); + $moduleContext = new ModuleContext($dbVer); + $modulePostUpdater = $this->moduleInstallerUpgraderFactory->createRecurringUpgrader($moduleName); + if ($modulePostUpdater) { + $modulePostUpdater->install($this->setup, $moduleContext); + } + } } /** diff --git a/setup/src/Magento/Setup/Module/ModuleInstallerUpgraderFactory.php b/setup/src/Magento/Setup/Module/ModuleInstallerUpgraderFactory.php index cf869f8fdfe6b..67653aacdb269 100644 --- a/setup/src/Magento/Setup/Module/ModuleInstallerUpgraderFactory.php +++ b/setup/src/Magento/Setup/Module/ModuleInstallerUpgraderFactory.php @@ -65,6 +65,20 @@ public function createSchemaUpgrader($moduleName) return $this->getInstallerUpgrader($schemaUpgrader); } + /** + * Creates recurring upgrader for a module + * + * @param $moduleName + * @return InstallSchemaInterface | null + */ + public function createRecurringUpgrader($moduleName) + { + $modulePath = str_replace('_', '/', $moduleName); + $recurringUpgrader = $this->directoryList->getPath(DirectoryList::MODULES) + . '/' . $modulePath . '/Setup/Recurring'; + return $this->getInstallerUpgrader($recurringUpgrader); + } + /** * Get the installer or upgrader for a module * From 42f168fe69c92c73a39f85109c73abe77382a486 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 18 Feb 2015 18:12:20 -0600 Subject: [PATCH 056/106] MAGETWO-34071: Create Data Install Scripts for Modules with Custom Setup Models - fixed code style --- app/code/Magento/Authorization/Setup/InstallSchema.php | 3 +-- app/code/Magento/Bundle/Setup/InstallSchema.php | 1 - app/code/Magento/Core/etc/di.xml | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Authorization/Setup/InstallSchema.php b/app/code/Magento/Authorization/Setup/InstallSchema.php index faa4442fccc16..ffc5c69dc5b30 100644 --- a/app/code/Magento/Authorization/Setup/InstallSchema.php +++ b/app/code/Magento/Authorization/Setup/InstallSchema.php @@ -143,6 +143,5 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con } $installer->endSetup(); - } -} \ No newline at end of file +} diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php index b78d928a7c4df..18bc10d387eff 100644 --- a/app/code/Magento/Bundle/Setup/InstallSchema.php +++ b/app/code/Magento/Bundle/Setup/InstallSchema.php @@ -1038,6 +1038,5 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getConnection()->createTable($table); $installer->endSetup(); - } } \ No newline at end of file diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index 56060c7d28e68..5ef402b4df422 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -8,7 +8,7 @@ - + From 2c2622b9d84e358ef97c0cc0115d4e4455d52e19 Mon Sep 17 00:00:00 2001 From: Maddy Chellathurai Date: Thu, 19 Feb 2015 09:28:55 -0600 Subject: [PATCH 057/106] MAGETWO-33889: Convert CE schema and data scripts to SPI classes - fix for broken build. --- app/code/Magento/SalesRule/Setup/InstallSchema.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/SalesRule/Setup/InstallSchema.php b/app/code/Magento/SalesRule/Setup/InstallSchema.php index 7bf34def357df..3ff3c99fa92cd 100644 --- a/app/code/Magento/SalesRule/Setup/InstallSchema.php +++ b/app/code/Magento/SalesRule/Setup/InstallSchema.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\SalesRule\Setup; use Magento\Framework\Setup\InstallSchemaInterface; From 5ed29a9a863445289ff05970ef5e062981e15184 Mon Sep 17 00:00:00 2001 From: Maddy Chellathurai Date: Thu, 19 Feb 2015 11:55:36 -0600 Subject: [PATCH 058/106] MAGETWO-33889: Convert CE schema and data scripts to SPI classes - phpcs and phpcd fixed. --- .../AdminNotification/Setup/InstallSchema.php | 3 +- .../Authorization/Setup/InstallSchema.php | 1 + app/code/Magento/Bundle/Setup/InstallData.php | 1 + .../Magento/Bundle/Setup/InstallSchema.php | 18 ++- .../Magento/Captcha/Setup/InstallSchema.php | 2 +- .../Magento/Catalog/Setup/InstallData.php | 3 + .../Magento/Catalog/Setup/InstallSchema.php | 109 ++++++++++++------ .../Magento/Catalog/Setup/UpgradeSchema.php | 2 +- .../CatalogInventory/Setup/InstallSchema.php | 6 +- .../Magento/CatalogRule/Setup/InstallData.php | 2 +- .../CatalogRule/Setup/InstallSchema.php | 6 +- .../CatalogSearch/Setup/InstallSchema.php | 2 +- .../CatalogUrlRewrite/Setup/InstallSchema.php | 2 +- .../Magento/Checkout/Setup/InstallData.php | 11 +- .../Setup/InstallSchema.php | 2 +- app/code/Magento/Cms/Setup/InstallData.php | 27 ++++- app/code/Magento/Cms/Setup/InstallSchema.php | 3 +- .../Setup/InstallSchema.php | 12 +- .../Setup/UpgradeSchema.php | 4 +- app/code/Magento/Core/Setup/InstallData.php | 2 +- app/code/Magento/Core/Setup/InstallSchema.php | 3 +- app/code/Magento/Cron/Setup/InstallSchema.php | 2 +- .../Magento/Customer/Setup/InstallData.php | 1 + .../Magento/Customer/Setup/InstallSchema.php | 9 +- .../DesignEditor/Setup/InstallSchema.php | 20 ++-- .../Magento/Directory/Setup/InstallData.php | 1 + .../Magento/Directory/Setup/InstallSchema.php | 6 +- .../Downloadable/Setup/InstallData.php | 1 + .../Downloadable/Setup/InstallSchema.php | 6 +- app/code/Magento/Eav/Setup/EavSetup.php | 1 + app/code/Magento/Eav/Setup/InstallSchema.php | 6 +- .../Magento/Email/Setup/InstallSchema.php | 1 + app/code/Magento/Fedex/Setup/InstallData.php | 19 +-- .../GiftMessage/Setup/InstallSchema.php | 2 +- .../GoogleOptimizer/Setup/InstallSchema.php | 2 +- .../GoogleShopping/Setup/InstallData.php | 3 +- .../GoogleShopping/Setup/InstallSchema.php | 6 +- .../ImportExport/Setup/InstallSchema.php | 2 +- .../Magento/Indexer/Setup/InstallSchema.php | 3 +- .../Integration/Setup/InstallSchema.php | 7 +- app/code/Magento/Log/Setup/InstallData.php | 2 +- app/code/Magento/Log/Setup/InstallSchema.php | 3 +- .../Newsletter/Setup/InstallSchema.php | 6 +- .../OfflineShipping/Setup/InstallSchema.php | 3 +- .../Persistent/Setup/InstallSchema.php | 2 +- .../ProductAlert/Setup/InstallSchema.php | 3 +- .../Magento/Quote/Setup/InstallSchema.php | 3 +- app/code/Magento/Quote/Setup/QuoteSetup.php | 2 + .../Magento/Reports/Setup/InstallSchema.php | 18 ++- app/code/Magento/Review/Setup/InstallData.php | 2 +- .../Magento/Review/Setup/InstallSchema.php | 3 +- app/code/Magento/Sales/Setup/InstallData.php | 5 + .../Magento/Sales/Setup/InstallSchema.php | 15 ++- app/code/Magento/Sales/Setup/SalesSetup.php | 3 +- .../Magento/Sales/Setup/UpgradeSchema.php | 2 +- .../Magento/SalesRule/Setup/InstallData.php | 2 +- .../Magento/SalesRule/Setup/InstallSchema.php | 3 +- .../Magento/Search/Setup/InstallSchema.php | 3 +- .../Sendfriend/Setup/InstallSchema.php | 2 +- .../Magento/Sitemap/Setup/InstallSchema.php | 2 +- .../Magento/Store/Setup/InstallSchema.php | 6 +- app/code/Magento/Tax/Setup/InstallSchema.php | 3 +- .../Magento/Theme/Setup/InstallSchema.php | 3 +- .../Magento/Theme/Setup/UpgradeSchema.php | 2 +- .../Translation/Setup/InstallSchema.php | 2 +- .../UrlRewrite/Setup/InstallSchema.php | 3 +- app/code/Magento/User/Setup/InstallSchema.php | 3 +- app/code/Magento/Usps/Setup/InstallData.php | 2 +- app/code/Magento/Weee/Setup/InstallSchema.php | 3 +- app/code/Magento/Weee/Setup/UpgradeSchema.php | 2 +- app/code/Magento/Widget/Setup/InstallData.php | 2 +- .../Magento/Widget/Setup/InstallSchema.php | 6 +- .../Magento/Wishlist/Setup/InstallSchema.php | 6 +- .../Test/Legacy/_files/obsolete_classes.php | 1 - .../Php/_files/phpcpd/blacklist/common.txt | 1 + .../Setup/Module/Setup/SetupCacheTest.php | 3 +- 76 files changed, 296 insertions(+), 155 deletions(-) diff --git a/app/code/Magento/AdminNotification/Setup/InstallSchema.php b/app/code/Magento/AdminNotification/Setup/InstallSchema.php index 462700c106661..a86c258e67b57 100644 --- a/app/code/Magento/AdminNotification/Setup/InstallSchema.php +++ b/app/code/Magento/AdminNotification/Setup/InstallSchema.php @@ -14,6 +14,7 @@ class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { @@ -118,4 +119,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Authorization/Setup/InstallSchema.php b/app/code/Magento/Authorization/Setup/InstallSchema.php index ffc5c69dc5b30..57f6b98e7d8bb 100644 --- a/app/code/Magento/Authorization/Setup/InstallSchema.php +++ b/app/code/Magento/Authorization/Setup/InstallSchema.php @@ -14,6 +14,7 @@ class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { diff --git a/app/code/Magento/Bundle/Setup/InstallData.php b/app/code/Magento/Bundle/Setup/InstallData.php index 99bd54fccfcdd..cf2550f31f5dd 100644 --- a/app/code/Magento/Bundle/Setup/InstallData.php +++ b/app/code/Magento/Bundle/Setup/InstallData.php @@ -33,6 +33,7 @@ public function __construct(EavSetupFactory $eavSetupFactory) /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php index 18bc10d387eff..340bb996259bc 100644 --- a/app/code/Magento/Bundle/Setup/InstallSchema.php +++ b/app/code/Magento/Bundle/Setup/InstallSchema.php @@ -14,6 +14,7 @@ class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { @@ -66,7 +67,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['parent_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_bundle_option', + $installer->getFkName( + 'catalog_product_bundle_option', 'parent_id', 'catalog_product_entity', 'entity_id' @@ -237,7 +239,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_bundle_selection', + $installer->getFkName( + 'catalog_product_bundle_selection', 'product_id', 'catalog_product_entity', 'entity_id' @@ -290,7 +293,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['website_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_bundle_selection_price', + $installer->getFkName( + 'catalog_product_bundle_selection_price', 'website_id', 'store_website', 'website_id' @@ -380,7 +384,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_bundle_price_index', + $installer->getFkName( + 'catalog_product_bundle_price_index', 'entity_id', 'catalog_product_entity', 'entity_id' @@ -392,7 +397,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_bundle_price_index', + $installer->getFkName( + 'catalog_product_bundle_price_index', 'website_id', 'store_website', 'website_id' @@ -1039,4 +1045,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Captcha/Setup/InstallSchema.php b/app/code/Magento/Captcha/Setup/InstallSchema.php index 6ff912413a991..8440d01aabe58 100644 --- a/app/code/Magento/Captcha/Setup/InstallSchema.php +++ b/app/code/Magento/Captcha/Setup/InstallSchema.php @@ -55,4 +55,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Catalog/Setup/InstallData.php b/app/code/Magento/Catalog/Setup/InstallData.php index 7f57cc8cd1c09..7b9e79a306ad0 100644 --- a/app/code/Magento/Catalog/Setup/InstallData.php +++ b/app/code/Magento/Catalog/Setup/InstallData.php @@ -31,6 +31,9 @@ public function __construct(CategorySetupFactory $categorySetupFactory) /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @SuppressWarnings(PHPMD.NPathComplexity) */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php index 684058651384f..60a483c6c704b 100644 --- a/app/code/Magento/Catalog/Setup/InstallSchema.php +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -14,6 +14,7 @@ class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { @@ -102,7 +103,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['sku'] ) ->addForeignKey( - $installer->getFkName('catalog_product_entity', + $installer->getFkName( + 'catalog_product_entity', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id' @@ -189,7 +191,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['store_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', + $installer->getFkName( + 'catalog_product_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id' @@ -201,7 +204,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', + $installer->getFkName( + 'catalog_product_entity_datetime', 'entity_id', 'catalog_product_entity', 'entity_id' @@ -288,7 +292,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['attribute_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', + $installer->getFkName( + 'catalog_product_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id' @@ -300,7 +305,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', + $installer->getFkName( + 'catalog_product_entity_decimal', 'entity_id', 'catalog_product_entity', 'entity_id' @@ -478,7 +484,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['store_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_text', + $installer->getFkName( + 'catalog_product_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id' @@ -490,7 +497,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_text', + $installer->getFkName( + 'catalog_product_entity_text', 'entity_id', 'catalog_product_entity', 'entity_id' @@ -577,7 +585,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['store_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', + $installer->getFkName( + 'catalog_product_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id' @@ -589,7 +598,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', + $installer->getFkName( + 'catalog_product_entity_varchar', 'entity_id', 'catalog_product_entity', 'entity_id' @@ -687,7 +697,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['store_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', + $installer->getFkName( + 'catalog_product_entity_gallery', 'attribute_id', 'eav_attribute', 'attribute_id' @@ -699,7 +710,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', + $installer->getFkName( + 'catalog_product_entity_gallery', 'entity_id', 'catalog_product_entity', 'entity_id' @@ -872,7 +884,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['store_id'] ) ->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', + $installer->getFkName( + 'catalog_category_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id' @@ -884,7 +897,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', + $installer->getFkName( + 'catalog_category_entity_datetime', 'entity_id', 'catalog_category_entity', 'entity_id' @@ -975,7 +989,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['store_id'] ) ->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', + $installer->getFkName( + 'catalog_category_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id' @@ -987,7 +1002,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', + $installer->getFkName( + 'catalog_category_entity_decimal', 'entity_id', 'catalog_category_entity', 'entity_id' @@ -1086,7 +1102,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_category_entity_int', + $installer->getFkName( + 'catalog_category_entity_int', 'entity_id', 'catalog_category_entity', 'entity_id' @@ -1185,7 +1202,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_category_entity_text', + $installer->getFkName( + 'catalog_category_entity_text', 'entity_id', 'catalog_category_entity', 'entity_id' @@ -1276,7 +1294,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['store_id'] ) ->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', + $installer->getFkName( + 'catalog_category_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id' @@ -1288,7 +1307,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', + $installer->getFkName( + 'catalog_category_entity_varchar', 'entity_id', 'catalog_category_entity', 'entity_id' @@ -1341,7 +1361,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['product_id'] ) ->addForeignKey( - $installer->getFkName('catalog_category_product', + $installer->getFkName( + 'catalog_category_product', 'category_id', 'catalog_category_entity', 'entity_id' @@ -1642,7 +1663,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['linked_product_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_link', + $installer->getFkName( + 'catalog_product_link', 'linked_product_id', 'catalog_product_entity', 'entity_id' @@ -1662,7 +1684,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_link', + $installer->getFkName( + 'catalog_product_link', 'link_type_id', 'catalog_product_link_type', 'link_type_id' @@ -1786,7 +1809,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] ) ->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_decimal', + $installer->getFkName( + 'catalog_product_link_attribute_decimal', 'link_id', 'catalog_product_link', 'link_id' @@ -1865,7 +1889,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] ) ->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_int', + $installer->getFkName( + 'catalog_product_link_attribute_int', 'link_id', 'catalog_product_link', 'link_id' @@ -1944,7 +1969,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] ) ->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_varchar', + $installer->getFkName( + 'catalog_product_link_attribute_varchar', 'link_id', 'catalog_product_link', 'link_id' @@ -2061,7 +2087,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_tier_price', + $installer->getFkName( + 'catalog_product_entity_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id' @@ -2130,7 +2157,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['entity_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_media_gallery', + $installer->getFkName( + 'catalog_product_entity_media_gallery', 'attribute_id', 'eav_attribute', 'attribute_id' @@ -2408,7 +2436,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['store_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_option_price', + $installer->getFkName( + 'catalog_product_option_price', 'option_id', 'catalog_product_option', 'option_id' @@ -2482,7 +2511,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['store_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_option_title', + $installer->getFkName( + 'catalog_product_option_title', 'option_id', 'catalog_product_option', 'option_id' @@ -2547,7 +2577,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['option_id'] ) ->addForeignKey( - $installer->getFkName('catalog_product_option_type_value', + $installer->getFkName( + 'catalog_product_option_type_value', 'option_id', 'catalog_product_option', 'option_id' @@ -3139,7 +3170,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_index_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + $installer->getFkName( + 'catalog_product_index_price', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', @@ -4569,7 +4605,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_group_price', + $installer->getFkName( + 'catalog_product_entity_group_price', 'entity_id', 'catalog_product_entity', 'entity_id' @@ -4581,7 +4618,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_entity_group_price', + $installer->getFkName( + 'catalog_product_entity_group_price', 'website_id', 'store_website', 'website_id' @@ -4656,7 +4694,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( - $installer->getFkName('catalog_product_index_group_price', + $installer->getFkName( + 'catalog_product_index_group_price', 'entity_id', 'catalog_product_entity', 'entity_id' @@ -4684,4 +4723,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index 6ac8155bd5d05..c63b67455d3be 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -48,4 +48,4 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } } -} \ No newline at end of file +} diff --git a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php index f8d5bbef72b54..446c9ddd85f47 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php @@ -14,6 +14,7 @@ class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { @@ -270,7 +271,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['stock_id'] ) ->addForeignKey( - $installer->getFkName('cataloginventory_stock_item', + $installer->getFkName( + 'cataloginventory_stock_item', 'product_id', 'catalog_product_entity', 'entity_id' @@ -456,4 +458,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } -} \ No newline at end of file +} diff --git a/app/code/Magento/CatalogRule/Setup/InstallData.php b/app/code/Magento/CatalogRule/Setup/InstallData.php index d0ea24a7e3e6d..93b468ef5e6c0 100755 --- a/app/code/Magento/CatalogRule/Setup/InstallData.php +++ b/app/code/Magento/CatalogRule/Setup/InstallData.php @@ -40,4 +40,4 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $setup->endSetup(); } -} \ No newline at end of file +} diff --git a/app/code/Magento/CatalogRule/Setup/InstallSchema.php b/app/code/Magento/CatalogRule/Setup/InstallSchema.php index ee5b7813879bd..49c324faf8cfb 100644 --- a/app/code/Magento/CatalogRule/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogRule/Setup/InstallSchema.php @@ -14,6 +14,7 @@ class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { @@ -405,7 +406,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['website_id'] ) ->addForeignKey( - $installer->getFkName('catalogrule_group_website', + $installer->getFkName( + 'catalogrule_group_website', 'customer_group_id', 'customer_group', 'customer_group_id' @@ -530,4 +532,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } -} \ No newline at end of file +} diff --git a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php index c9e1591987b14..a1b2d4ff300d6 100644 --- a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php @@ -83,4 +83,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } -} \ No newline at end of file +} diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php index 0fe0398d73f29..f7be24301c61a 100644 --- a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php @@ -79,4 +79,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Checkout/Setup/InstallData.php b/app/code/Magento/Checkout/Setup/InstallData.php index be0503c02927b..6ed9f7cdf4b8c 100644 --- a/app/code/Magento/Checkout/Setup/InstallData.php +++ b/app/code/Magento/Checkout/Setup/InstallData.php @@ -43,6 +43,9 @@ public function __construct(EavSetupFactory $eavSetupFactory, Address $customerA /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { @@ -77,10 +80,10 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface '0' ); $showMiddlename = (bool)$this->customerAddress->getConfig( - 'middlename_show' - ) || $connection->fetchOne( - $select - ) > 0; + 'middlename_show' + ) || $connection->fetchOne( + $select + ) > 0; $select = $connection->select()->from( $setup->getTable('core_config_data'), diff --git a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php index da024ee5e4e35..cf7aa486664f1 100644 --- a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php +++ b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php @@ -111,4 +111,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->endSetup(); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Cms/Setup/InstallData.php b/app/code/Magento/Cms/Setup/InstallData.php index d4360db5a8c20..36ae002dbe6ec 100644 --- a/app/code/Magento/Cms/Setup/InstallData.php +++ b/app/code/Magento/Cms/Setup/InstallData.php @@ -34,6 +34,7 @@ public function __construct(PageFactory $pageFactory) /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { @@ -45,7 +46,16 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface 'meta_description' => 'Page description', 'identifier' => 'no-route', 'content_heading' => 'Whoops, our bad...', - 'content' => "

\r\n
The page you requested was not found, and we have a fine guess why.
\r\n
\r\n
    \r\n
  • If you typed the URL directly, please make sure the spelling is correct.
  • \r\n
  • If you clicked on a link to get here, the link is outdated.
  • \r\n
\r\n
\r\n
\r\n
What can you do?
\r\n
Have no fear, help is near! There are many ways you can get back on track with Magento Store.
\r\n
\r\n
    \r\n
  • Go back to the previous page.
  • \r\n
  • Use the search bar at the top of the page to search for your products.
  • \r\n
  • Follow these links to get you back on track!
    Store Home | My Account
\r\n", + 'content' => '
\r\n
The page you requested was not found, and we have a fine guess why.
\r\n' + . '
\r\n
    \r\n
  • If you typed the URL directly, please make sure the spelling' + . 'is correct.
  • \r\n
  • If you clicked on a link to get here, the link is outdated.
  • \r\n' + . '
\r\n
\r\n
\r\n
What can you do?
\r\n
Have no fear, help is near!' + . 'There are many ways you can get back on track with Magento Store.
\r\n
\r\n' + . '
    \r\n
  • Go back to the' + . 'previous page.
  • \r\n
  • Use the search bar at the top of the page to search for your' + . 'products.
  • \r\n
  • Follow these links to get you back on track!
    ' + . 'Store Home | ' + . 'My Account
\r\n",', 'is_active' => 1, 'stores' => [0], 'sort_order' => 0 @@ -65,7 +75,18 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface 'page_layout' => '1column', 'identifier' => 'enable-cookies', 'content_heading' => 'What are Cookies?', - 'content' => "
\r\n

\"Cookies\" are little pieces of data we send when you visit our store. Cookies help us get to know you better and personalize your experience. Plus they help protect you and other shoppers from fraud.

\r\n

Set your browser to accept cookies so you can buy items, save items, and receive customized recommendations. Here’s how:

\r\n\r\n
", + 'content' => "
\r\n

\"Cookies\" are little pieces of data" + . "we send when you visit our store. Cookies help us get to know you better and personalize your" + . "experience. Plus they help protect you and other shoppers from fraud.

\r\n" + . "

Set your browser to accept cookies so you can buy items, " + . "save items, and receive customized recommendations. Here’s how:

\r\n\r\n
", 'is_active' => 1, 'stores' => [0] ] @@ -306,7 +327,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface if ($footerLinksBlock->getId()) { $content = $footerLinksBlock->getContent(); - if (preg_match('/