private function clearUnnecessaryLockedObjects()
    {
        $this->installer->run(<<<SQL

DELETE FROM `m2epro_locked_object`
  WHERE model_name = 'M2ePro/Account'
  OR model_name = 'M2ePro/Marketplace';

SQL
);
    }
示例#2
0
    private function processSynchronizationConfigTable()
    {
        $connection = $this->installer->getConnection();
        $tempTable = $this->installer->getTable('m2epro_synchronization_config');
        $tempQuery = "SELECT * FROM `{$tempTable}` WHERE `group` IS NULL AND `key` = 'last_access'";
        $tempRow = $connection->query($tempQuery)->fetch();
        if ($tempRow === false) {
            $this->installer->run(<<<SQL

INSERT INTO `m2epro_synchronization_config` (`group`,`key`,`value`,`notice`,`update_date`,`create_date`) VALUES
(NULL, 'last_access', NULL, NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00'),
(NULL, 'last_run', NULL, NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00');

SQL
);
        }
        $where = "(`key` = 'max_deactivate_time') ";
        $where .= "OR (`group` = '/feedbacks/') ";
        $where .= "OR (`group` = '/marketplaces/') ";
        $where .= "OR (`group` = '/orders/') ";
        $where .= "OR (`group` = '/other_listings/') ";
        $where .= "OR (`group` = '/policies/') ";
        $where .= "OR (`group` = '/templates/') ";
        $where .= "OR (`group` = '/defaults/processing/') ";
        $where .= "OR (`group` = '/settings/profiler/')";
        $connection->delete($tempTable, $where);
        $connection->update($tempTable, array('key' => 'type'), "`group` = '/defaults/inspector/product_changes/' AND `key` = 'mode'");
        $subWhere = "`group` = '/amazon/orders/reserve_cancellation/' ";
        $subWhere .= "OR `group` = '/ebay/feedbacks/receive/' ";
        $subWhere .= "OR `group` = '/ebay/feedbacks/response/' ";
        $subWhere .= "OR `group` = '/ebay/orders/cancellation/' ";
        $subWhere .= "OR `group` = '/ebay/orders/reserve_cancellation/'";
        $connection->update($tempTable, array('key' => 'last_time'), "`key` = 'last_access' AND ({$subWhere})");
    }
    private function deleteOldData()
    {
        $connection = $this->installer->getConnection();
        $this->installer->run(<<<SQL

    DROP TABLE IF EXISTS `m2epro_listing_category`;
    DROP TABLE IF EXISTS `m2epro_ebay_listing_auto_category`;
    DROP TABLE IF EXISTS `m2epro_ebay_listing_auto_category_group`;

SQL
);
        $oldTable = $this->installer->getTable('m2epro_temp_ebay_listing_auto_category_group');
        $newTable = $this->installer->getTable('m2epro_ebay_listing_auto_category_group');
        if ($this->installer->tableExists($oldTable) && !$this->installer->tableExists($newTable)) {
            $connection->query("RENAME TABLE `{$oldTable}` TO `{$newTable}`");
        }
        $tempTable = $this->installer->getTable('m2epro_ebay_listing');
        $tempTableIndexList = $connection->getIndexList($tempTable);
        if (isset($tempTableIndexList[strtoupper('auto_mode')])) {
            $connection->dropKey($tempTable, 'auto_mode');
        }
        if (isset($tempTableIndexList[strtoupper('auto_global_adding_mode')])) {
            $connection->dropKey($tempTable, 'auto_global_adding_mode');
        }
        if (isset($tempTableIndexList[strtoupper('auto_website_adding_mode')])) {
            $connection->dropKey($tempTable, 'auto_website_adding_mode');
        }
        if (isset($tempTableIndexList[strtoupper('auto_website_deleting_mode')])) {
            $connection->dropKey($tempTable, 'auto_website_deleting_mode');
        }
        if ($connection->tableColumnExists($tempTable, 'auto_mode') !== false) {
            $connection->dropColumn($tempTable, 'auto_mode');
        }
        if ($connection->tableColumnExists($tempTable, 'auto_global_adding_mode') !== false) {
            $connection->dropColumn($tempTable, 'auto_global_adding_mode');
        }
        if ($connection->tableColumnExists($tempTable, 'auto_website_adding_mode') !== false) {
            $connection->dropColumn($tempTable, 'auto_website_adding_mode');
        }
        if ($connection->tableColumnExists($tempTable, 'auto_website_deleting_mode') !== false) {
            $connection->dropColumn($tempTable, 'auto_website_deleting_mode');
        }
        $tempTable = $this->installer->getTable('m2epro_listing');
        if ($connection->tableColumnExists($tempTable, 'categories_add_action') !== false) {
            $connection->dropColumn($tempTable, 'categories_add_action');
        }
        if ($connection->tableColumnExists($tempTable, 'categories_delete_action') !== false) {
            $connection->dropColumn($tempTable, 'categories_delete_action');
        }
    }
    private function processAmazonMarketplace()
    {
        $connection = $this->installer->getConnection();
        $tempTable = $this->installer->getTable('m2epro_amazon_marketplace');
        $tempTableIndexList = $connection->getIndexList($tempTable);
        if ($connection->tableColumnExists($tempTable, 'is_asin_available') === false) {
            $connection->addColumn($tempTable, 'is_asin_available', 'tinyint(2) UNSIGNED NOT NULL DEFAULT 1 AFTER default_currency');
        }
        if (!isset($tempTableIndexList[strtoupper('is_asin_available')])) {
            $connection->addKey($tempTable, 'is_asin_available', 'is_asin_available');
        }
        $this->installer->run(<<<SQL

    UPDATE `m2epro_amazon_marketplace`
    SET is_asin_available = 0
    WHERE marketplace_id = 24;

SQL
);
    }
    private function prepareOrdersConfigTable()
    {
        $connection = $this->installer->getConnection();
        $tempTable = $this->installer->getTable('m2epro_config');
        $tempQuery = <<<SQL
    SELECT * FROM `{$tempTable}`
    WHERE `group` = '/ebay/order/migration_to_v611/'
    AND   `key` = 'is_need_migrate'
SQL;
        $tempRow = $connection->query($tempQuery)->fetch();
        if ($tempRow === false) {
            $this->installer->run(<<<SQL

INSERT INTO `m2epro_config` (`group`,`key`,`value`,`notice`,`update_date`,`create_date`) VALUES
('/ebay/order/migration_to_v611/', 'is_need_migrate', '1', null, '2013-09-18 00:00:00', '2013-09-18 00:00:00');

SQL
);
        }
    }
示例#6
0
    private function processBuyShipping()
    {
        $this->installer->run(<<<SQL

UPDATE `m2epro_buy_listing`
SET shipping_standard_mode = 3
WHERE shipping_standard_mode = 0;

UPDATE `m2epro_buy_listing`
SET shipping_expedited_mode = 3
WHERE shipping_expedited_mode = 0;

UPDATE `m2epro_buy_listing`
SET shipping_one_day_mode = 3
WHERE shipping_one_day_mode = 0;

UPDATE `m2epro_buy_listing`
SET shipping_two_day_mode = 3
WHERE shipping_two_day_mode = 0;

SQL
);
    }
    private function processAmazonTemplates()
    {
        $this->installer->run(<<<SQL

CREATE TABLE IF NOT EXISTS `m2epro_amazon_template_description` (
  template_description_id INT(11) UNSIGNED NOT NULL,
  marketplace_id INT(11) UNSIGNED NOT NULL,
  is_new_asin_accepted TINYINT(2) UNSIGNED DEFAULT 0,
  product_data_nick VARCHAR(255) DEFAULT NULL,
  category_path VARCHAR(255) DEFAULT NULL,
  browsenode_id DECIMAL(20, 0) UNSIGNED DEFAULT NULL,
  registered_parameter VARCHAR(25) DEFAULT NULL,
  worldwide_id_mode TINYINT(2) UNSIGNED DEFAULT 0,
  worldwide_id_custom_attribute VARCHAR(255) DEFAULT NULL,
  item_package_quantity_mode TINYINT(2) UNSIGNED DEFAULT 0,
  item_package_quantity_custom_value VARCHAR(255) DEFAULT NULL,
  item_package_quantity_custom_attribute VARCHAR(255) DEFAULT NULL,
  number_of_items_mode TINYINT(2) UNSIGNED DEFAULT 0,
  number_of_items_custom_value VARCHAR(255) DEFAULT NULL,
  number_of_items_custom_attribute VARCHAR(255) DEFAULT NULL,
  PRIMARY KEY (template_description_id),
  INDEX marketplace_id (marketplace_id),
  INDEX is_new_asin_accepted (is_new_asin_accepted),
  INDEX product_data_nick (product_data_nick),
  INDEX browsenode_id (browsenode_id)
)
ENGINE = INNODB
CHARACTER SET utf8
COLLATE utf8_general_ci;

CREATE TABLE IF NOT EXISTS `m2epro_amazon_template_description_definition` (
  template_description_id INT(11) UNSIGNED NOT NULL,
  title_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
  title_template VARCHAR(255) NOT NULL,
  brand_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
  brand_custom_value VARCHAR(255) DEFAULT NULL,
  brand_custom_attribute VARCHAR(255) DEFAULT NULL,
  manufacturer_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
  manufacturer_custom_value VARCHAR(255) DEFAULT NULL,
  manufacturer_custom_attribute VARCHAR(255) DEFAULT NULL,
  manufacturer_part_number_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
  manufacturer_part_number_custom_value VARCHAR(255) NOT NULL,
  manufacturer_part_number_custom_attribute VARCHAR(255) NOT NULL,
  item_dimensions_volume_mode TINYINT(2) UNSIGNED DEFAULT 0,
  item_dimensions_volume_length_custom_value VARCHAR(255) DEFAULT NULL,
  item_dimensions_volume_width_custom_value VARCHAR(255) DEFAULT NULL,
  item_dimensions_volume_height_custom_value VARCHAR(255) DEFAULT NULL,
  item_dimensions_volume_length_custom_attribute VARCHAR(255) DEFAULT NULL,
  item_dimensions_volume_width_custom_attribute VARCHAR(255) DEFAULT NULL,
  item_dimensions_volume_height_custom_attribute VARCHAR(255) DEFAULT NULL,
  item_dimensions_volume_unit_of_measure_mode TINYINT(2) UNSIGNED DEFAULT 0,
  item_dimensions_volume_unit_of_measure_custom_value VARCHAR(255) DEFAULT NULL,
  item_dimensions_volume_unit_of_measure_custom_attribute VARCHAR(255) DEFAULT NULL,
  item_dimensions_weight_mode TINYINT(2) UNSIGNED DEFAULT 0,
  item_dimensions_weight_custom_value DECIMAL(10, 2) UNSIGNED DEFAULT NULL,
  item_dimensions_weight_custom_attribute VARCHAR(255) DEFAULT NULL,
  item_dimensions_weight_unit_of_measure_mode TINYINT(2) UNSIGNED DEFAULT 0,
  item_dimensions_weight_unit_of_measure_custom_value VARCHAR(255) DEFAULT NULL,
  item_dimensions_weight_unit_of_measure_custom_attribute VARCHAR(255) DEFAULT NULL,
  package_dimensions_volume_mode TINYINT(2) UNSIGNED DEFAULT 0,
  package_dimensions_volume_length_custom_value VARCHAR(255) DEFAULT NULL,
  package_dimensions_volume_width_custom_value VARCHAR(255) DEFAULT NULL,
  package_dimensions_volume_height_custom_value VARCHAR(255) DEFAULT NULL,
  package_dimensions_volume_length_custom_attribute VARCHAR(255) DEFAULT NULL,
  package_dimensions_volume_width_custom_attribute VARCHAR(255) DEFAULT NULL,
  package_dimensions_volume_height_custom_attribute VARCHAR(255) DEFAULT NULL,
  package_dimensions_volume_unit_of_measure_mode TINYINT(2) UNSIGNED DEFAULT 0,
  package_dimensions_volume_unit_of_measure_custom_value VARCHAR(255) DEFAULT NULL,
  package_dimensions_volume_unit_of_measure_custom_attribute VARCHAR(255) DEFAULT NULL,
  shipping_weight_mode TINYINT(2) UNSIGNED DEFAULT 0,
  shipping_weight_custom_value DECIMAL(10, 2) UNSIGNED DEFAULT NULL,
  shipping_weight_custom_attribute VARCHAR(255) DEFAULT NULL,
  shipping_weight_unit_of_measure_mode TINYINT(2) UNSIGNED DEFAULT 1,
  shipping_weight_unit_of_measure_custom_value VARCHAR(255) DEFAULT NULL,
  shipping_weight_unit_of_measure_custom_attribute VARCHAR(255) DEFAULT NULL,
  package_weight_mode TINYINT(2) UNSIGNED DEFAULT 0,
  package_weight_custom_value DECIMAL(10, 2) UNSIGNED DEFAULT NULL,
  package_weight_custom_attribute VARCHAR(255) DEFAULT NULL,
  package_weight_unit_of_measure_mode TINYINT(2) UNSIGNED DEFAULT 1,
  package_weight_unit_of_measure_custom_value VARCHAR(255) DEFAULT NULL,
  package_weight_unit_of_measure_custom_attribute VARCHAR(255) DEFAULT NULL,
  target_audience_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
  target_audience TEXT NOT NULL,
  search_terms_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
  search_terms TEXT NOT NULL,
  bullet_points_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
  bullet_points TEXT NOT NULL,
  description_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
  description_template LONGTEXT NOT NULL,
  image_main_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
  image_main_attribute VARCHAR(255) NOT NULL,
  gallery_images_mode TINYINT(2) UNSIGNED NOT NULL,
  gallery_images_limit TINYINT(2) UNSIGNED NOT NULL DEFAULT 1,
  gallery_images_attribute VARCHAR(255) NOT NULL,
  update_date DATETIME DEFAULT NULL,
  create_date DATETIME DEFAULT NULL,
  PRIMARY KEY (template_description_id)
)
ENGINE = INNODB
CHARACTER SET utf8
COLLATE utf8_general_ci;

CREATE TABLE IF NOT EXISTS `m2epro_amazon_template_description_specific` (
  id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  template_description_id INT(11) UNSIGNED NOT NULL,
  xpath VARCHAR(255) NOT NULL,
  mode VARCHAR(25) NOT NULL,
  recommended_value VARCHAR(255) DEFAULT NULL,
  custom_value VARCHAR(255) DEFAULT NULL,
  custom_attribute VARCHAR(255) DEFAULT NULL,
  type VARCHAR(25) DEFAULT NULL,
  attributes TEXT DEFAULT NULL,
  update_date DATETIME DEFAULT NULL,
  create_date DATETIME DEFAULT NULL,
  PRIMARY KEY (id),
  INDEX template_description_id (template_description_id)
)
ENGINE = INNODB
CHARACTER SET utf8
COLLATE utf8_general_ci;

SQL
);
    }
    private function processSearch()
    {
        $connection = $this->installer->getConnection();
        $tempTable = $this->installer->getTable('m2epro_amazon_listing_product');
        if ($connection->tableColumnExists($tempTable, 'general_id_search_status') !== false) {
            $this->installer->run(<<<SQL

UPDATE `m2epro_amazon_listing_product`
SET general_id_search_status = 0,
    general_id_search_suggest_data = NULL;

UPDATE `m2epro_buy_listing_product`
SET general_id_search_status = 0,
    general_id_search_suggest_data = NULL;

UPDATE `m2epro_play_listing_product`
SET general_id_search_status = 0,
    general_id_search_suggest_data = NULL;
SQL
);
        }
        if ($connection->tableColumnExists($tempTable, 'general_id_search_status') !== false && $connection->tableColumnExists($tempTable, 'search_settings_status') === false) {
            $connection->changeColumn($tempTable, 'general_id_search_status', 'search_settings_status', 'TINYINT(2) UNSIGNED DEFAULT NULL');
        }
        if ($connection->tableColumnExists($tempTable, 'general_id_search_suggest_data') !== false && $connection->tableColumnExists($tempTable, 'search_settings_data') === false) {
            $connection->changeColumn($tempTable, 'general_id_search_suggest_data', 'search_settings_data', 'TEXT DEFAULT NULL');
        }
        if ($connection->tableColumnExists($tempTable, 'general_id_search_info') === false) {
            $connection->addColumn($tempTable, 'general_id_search_info', 'TEXT DEFAULT NULL AFTER general_id');
        }
        $tempTableIndexList = $connection->getIndexList($tempTable);
        if (isset($tempTableIndexList[strtoupper('general_id_search_status')])) {
            $connection->dropKey($tempTable, 'general_id_search_status');
        }
        if (!isset($tempTableIndexList[strtoupper('search_settings_status')])) {
            $connection->addKey($tempTable, 'search_settings_status', 'search_settings_status');
        }
        $tempTable = $this->installer->getTable('m2epro_buy_listing_product');
        if ($connection->tableColumnExists($tempTable, 'general_id_search_status') !== false && $connection->tableColumnExists($tempTable, 'search_settings_status') === false) {
            $connection->changeColumn($tempTable, 'general_id_search_status', 'search_settings_status', 'TINYINT(2) UNSIGNED DEFAULT NULL');
        }
        if ($connection->tableColumnExists($tempTable, 'general_id_search_suggest_data') !== false && $connection->tableColumnExists($tempTable, 'search_settings_data') === false) {
            $connection->changeColumn($tempTable, 'general_id_search_suggest_data', 'search_settings_data', 'TEXT DEFAULT NULL');
        }
        if ($connection->tableColumnExists($tempTable, 'general_id_search_info') === false) {
            $connection->addColumn($tempTable, 'general_id_search_info', 'TEXT DEFAULT NULL AFTER general_id');
        }
        $tempTableIndexList = $connection->getIndexList($tempTable);
        if (isset($tempTableIndexList[strtoupper('general_id_search_status')])) {
            $connection->dropKey($tempTable, 'general_id_search_status');
        }
        if (!isset($tempTableIndexList[strtoupper('search_settings_status')])) {
            $connection->addKey($tempTable, 'search_settings_status', 'search_settings_status');
        }
        $tempTable = $this->installer->getTable('m2epro_play_listing_product');
        if ($connection->tableColumnExists($tempTable, 'general_id_search_status') !== false && $connection->tableColumnExists($tempTable, 'search_settings_status') === false) {
            $connection->changeColumn($tempTable, 'general_id_search_status', 'search_settings_status', 'TINYINT(2) UNSIGNED DEFAULT NULL');
        }
        if ($connection->tableColumnExists($tempTable, 'general_id_search_suggest_data') !== false && $connection->tableColumnExists($tempTable, 'search_settings_data') === false) {
            $connection->changeColumn($tempTable, 'general_id_search_suggest_data', 'search_settings_data', 'TEXT DEFAULT NULL');
        }
        if ($connection->tableColumnExists($tempTable, 'general_id_search_info') === false) {
            $connection->addColumn($tempTable, 'general_id_search_info', 'TEXT DEFAULT NULL AFTER link_info');
        }
        $tempTableIndexList = $connection->getIndexList($tempTable);
        if (isset($tempTableIndexList[strtoupper('general_id_search_status')])) {
            $connection->dropKey($tempTable, 'general_id_search_status');
        }
        if (!isset($tempTableIndexList[strtoupper('search_settings_status')])) {
            $connection->addKey($tempTable, 'search_settings_status', 'search_settings_status');
        }
    }
示例#9
0
    private function alterTables()
    {
        $connection = $this->installer->getConnection();
        $tempTable = $this->installer->getTable('m2epro_amazon_template_description');
        $tempTableIndexList = $connection->getIndexList($tempTable);
        if ($connection->tableColumnExists($tempTable, 'title') !== false) {
            $connection->dropColumn($tempTable, 'title');
        }
        if ($connection->tableColumnExists($tempTable, 'create_date') !== false) {
            $connection->dropColumn($tempTable, 'create_date');
        }
        if ($connection->tableColumnExists($tempTable, 'update_date') !== false) {
            $connection->dropColumn($tempTable, 'update_date');
        }
        if ($connection->tableColumnExists($tempTable, 'node_title') !== false) {
            $connection->dropColumn($tempTable, 'node_title');
        }
        if ($connection->tableColumnExists($tempTable, 'xsd_hash') !== false) {
            $connection->dropColumn($tempTable, 'xsd_hash');
        }
        if ($connection->tableColumnExists($tempTable, 'identifiers') !== false) {
            $connection->dropColumn($tempTable, 'identifiers');
        }
        if ($connection->tableColumnExists($tempTable, 'id') !== false && $connection->tableColumnExists($tempTable, 'template_description_id') === false) {
            $this->installer->run(<<<SQL

ALTER TABLE `m2epro_amazon_template_description`
    CHANGE COLUMN id template_description_id int(11) UNSIGNED NOT NULL,
    DROP PRIMARY KEY,
    ADD PRIMARY KEY (template_description_id);

SQL
);
        }
        if ($connection->tableColumnExists($tempTable, 'category_path') !== false) {
            $connection->changeColumn($tempTable, 'category_path', 'category_path', 'VARCHAR(255) DEFAULT NULL');
        }
        if ($connection->tableColumnExists($tempTable, 'is_new_asin_accepted') === false) {
            $connection->addColumn($tempTable, 'is_new_asin_accepted', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER marketplace_id');
        }
        if ($connection->tableColumnExists($tempTable, 'product_data_nick') === false) {
            $connection->addColumn($tempTable, 'product_data_nick', 'VARCHAR(255) DEFAULT NULL AFTER is_new_asin_accepted');
        }
        if ($connection->tableColumnExists($tempTable, 'browsenode_id') === false) {
            $connection->addColumn($tempTable, 'browsenode_id', 'DECIMAL(20, 0) UNSIGNED DEFAULT NULL AFTER category_path');
        }
        if (!isset($tempTableIndexList[strtoupper('is_new_asin_accepted')])) {
            $connection->addKey($tempTable, 'is_new_asin_accepted', 'is_new_asin_accepted');
        }
        if (!isset($tempTableIndexList[strtoupper('product_data_nick')])) {
            $connection->addKey($tempTable, 'product_data_nick', 'product_data_nick');
        }
        if (!isset($tempTableIndexList[strtoupper('browsenode_id')])) {
            $connection->addKey($tempTable, 'browsenode_id', 'browsenode_id');
        }
        // ------------------------------
        $tempTable = $this->installer->getTable('m2epro_amazon_template_description_definition');
        if ($connection->tableColumnExists($tempTable, 'template_new_product_id') !== false && $connection->tableColumnExists($tempTable, 'template_description_id') === false) {
            $this->installer->run(<<<SQL

ALTER TABLE `m2epro_amazon_template_description_definition`
    CHANGE COLUMN template_new_product_id template_description_id int(11) UNSIGNED NOT NULL,
    DROP PRIMARY KEY,
    ADD PRIMARY KEY (template_description_id);

SQL
);
        }
        if ($connection->tableColumnExists($tempTable, 'brand_custom_attribute') === false && $connection->tableColumnExists($tempTable, 'brand_template') !== false) {
            $connection->changeColumn($tempTable, 'brand_template', 'brand_custom_attribute', 'VARCHAR(255) DEFAULT NULL');
        }
        if ($connection->tableColumnExists($tempTable, 'manufacturer_custom_attribute') === false && $connection->tableColumnExists($tempTable, 'manufacturer_template') !== false) {
            $connection->changeColumn($tempTable, 'manufacturer_template', 'manufacturer_custom_attribute', 'VARCHAR(255) DEFAULT NULL');
        }
        if ($connection->tableColumnExists($tempTable, 'target_audience') === false && $connection->tableColumnExists($tempTable, 'target_audience_custom_value') !== false) {
            $connection->changeColumn($tempTable, 'target_audience_custom_value', 'target_audience', 'TEXT NOT NULL');
        }
        if ($connection->tableColumnExists($tempTable, 'brand_custom_value') === false) {
            $connection->addColumn($tempTable, 'brand_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER `brand_mode`');
        }
        if ($connection->tableColumnExists($tempTable, 'manufacturer_custom_value') === false) {
            $connection->addColumn($tempTable, 'manufacturer_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER manufacturer_mode');
        }
        if ($connection->tableColumnExists($tempTable, 'target_audience_custom_attribute') !== false) {
            $connection->dropColumn($tempTable, 'target_audience_custom_attribute');
        }
        // -----
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_mode') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_volume_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER manufacturer_part_number_custom_attribute');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_length_custom_value') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_volume_length_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_mode');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_width_custom_value') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_volume_width_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_length_custom_value');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_height_custom_value') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_volume_height_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_width_custom_value');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_length_custom_attribute') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_volume_length_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_height_custom_value');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_width_custom_attribute') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_volume_width_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_length_custom_attribute');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_height_custom_attribute') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_volume_height_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_width_custom_attribute');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_unit_of_measure_mode') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_volume_unit_of_measure_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER item_dimensions_volume_height_custom_attribute');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_unit_of_measure_custom_value') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_volume_unit_of_measure_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_unit_of_measure_mode');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_unit_of_measure_custom_attribute') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_volume_unit_of_measure_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_unit_of_measure_custom_value');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_mode') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_weight_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER item_dimensions_volume_unit_of_measure_custom_attribute');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_custom_value') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_weight_custom_value', 'DECIMAL(10, 2) UNSIGNED DEFAULT NULL AFTER item_dimensions_weight_mode');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_custom_attribute') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_weight_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_weight_custom_value');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_unit_of_measure_mode') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_weight_unit_of_measure_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER item_dimensions_weight_custom_attribute');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_unit_of_measure_custom_value') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_weight_unit_of_measure_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_weight_unit_of_measure_mode');
        }
        if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_unit_of_measure_custom_attribute') === false) {
            $connection->addColumn($tempTable, 'item_dimensions_weight_unit_of_measure_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_weight_unit_of_measure_custom_value');
        }
        // -----
        if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_mode') === false) {
            $connection->addColumn($tempTable, 'package_dimensions_volume_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER item_dimensions_weight_unit_of_measure_custom_attribute');
        }
        if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_length_custom_value') === false) {
            $connection->addColumn($tempTable, 'package_dimensions_volume_length_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_mode');
        }
        if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_width_custom_value') === false) {
            $connection->addColumn($tempTable, 'package_dimensions_volume_width_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_length_custom_value');
        }
        if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_height_custom_value') === false) {
            $connection->addColumn($tempTable, 'package_dimensions_volume_height_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_width_custom_value');
        }
        if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_length_custom_attribute') === false) {
            $connection->addColumn($tempTable, 'package_dimensions_volume_length_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_height_custom_value');
        }
        if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_width_custom_attribute') === false) {
            $connection->addColumn($tempTable, 'package_dimensions_volume_width_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_length_custom_attribute');
        }
        if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_height_custom_attribute') === false) {
            $connection->addColumn($tempTable, 'package_dimensions_volume_height_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_width_custom_attribute');
        }
        if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_unit_of_measure_mode') === false) {
            $connection->addColumn($tempTable, 'package_dimensions_volume_unit_of_measure_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER package_dimensions_volume_height_custom_attribute');
        }
        $columnName = 'package_dimensions_volume_unit_of_measure_custom_value';
        if ($connection->tableColumnExists($tempTable, $columnName) === false) {
            $connection->addColumn($tempTable, $columnName, 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_unit_of_measure_mode');
        }
        $columnName = 'package_dimensions_volume_unit_of_measure_custom_attribute';
        if ($connection->tableColumnExists($tempTable, $columnName) === false) {
            $connection->addColumn($tempTable, $columnName, 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_unit_of_measure_custom_value');
        }
        // ------------------------------
        $tempTable = $this->installer->getTable('m2epro_amazon_template_description_specific');
        $tempTableIndexList = $connection->getIndexList($tempTable);
        if (isset($tempTableIndexList[strtoupper('template_new_product_id')])) {
            $connection->dropKey($tempTable, 'template_new_product_id');
        }
        if ($connection->tableColumnExists($tempTable, 'template_new_product_id') !== false && $connection->tableColumnExists($tempTable, 'template_description_id') === false) {
            $connection->changeColumn($tempTable, 'template_new_product_id', 'template_description_id', 'int(11) UNSIGNED NOT NULL');
        }
        if (!isset($tempTableIndexList[strtoupper('template_description_id')])) {
            $connection->addKey($tempTable, 'template_description_id', 'template_description_id');
        }
        // ------------------------------
    }