[-] Installer : changed the primary keys of tha language tables of category, product, meta, carrier #PSCFV-3726

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17291 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
dMetzger committed 2012-09-11 15:58:10 +00:00
1 parent 4f5785f307
commit 40e069c117
3 files changed
+26 -26

No files matched your search

+19 -19
View File
@@ -156,13 +156,13 @@ CREATE TABLE `PREFIX_carrier_lang` (
`id_shop` int(11) unsigned NOT NULL DEFAULT '1', `id_shop` int(11) unsigned NOT NULL DEFAULT '1',
`id_lang` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL,
`delay` varchar(128) DEFAULT NULL, `delay` varchar(128) DEFAULT NULL,
PRIMARY KEY `shipper_lang_index` (`id_lang`,`id_shop`, `id_carrier`) PRIMARY KEY (`id_lang`,`id_shop`, `id_carrier`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_carrier_zone` ( CREATE TABLE `PREFIX_carrier_zone` (
`id_carrier` int(10) unsigned NOT NULL, `id_carrier` int(10) unsigned NOT NULL,
`id_zone` int(10) unsigned NOT NULL, `id_zone` int(10) unsigned NOT NULL,
PRIMARY KEY `carrier_zone_index` (`id_carrier`,`id_zone`) PRIMARY KEY (`id_carrier`,`id_zone`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_cart` ( CREATE TABLE `PREFIX_cart` (
@@ -331,7 +331,7 @@ CREATE TABLE `PREFIX_category` (
CREATE TABLE `PREFIX_category_group` ( CREATE TABLE `PREFIX_category_group` (
`id_category` int(10) unsigned NOT NULL, `id_category` int(10) unsigned NOT NULL,
`id_group` int(10) unsigned NOT NULL, `id_group` int(10) unsigned NOT NULL,
UNIQUE KEY `category_group_index` (`id_category`,`id_group`), PRIMARY KEY (`id_category`,`id_group`),
KEY `id_category` (`id_category`), KEY `id_category` (`id_category`),
KEY `id_group` (`id_group`) KEY `id_group` (`id_group`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
@@ -346,7 +346,7 @@ CREATE TABLE `PREFIX_category_lang` (
`meta_title` varchar(128) default NULL, `meta_title` varchar(128) default NULL,
`meta_keywords` varchar(255) default NULL, `meta_keywords` varchar(255) default NULL,
`meta_description` varchar(255) default NULL, `meta_description` varchar(255) default NULL,
UNIQUE KEY `category_lang_index` (`id_category`,`id_shop`, `id_lang`), PRIMARY KEY (`id_category`,`id_shop`, `id_lang`),
KEY `category_name` (`name`) KEY `category_name` (`name`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
@@ -489,7 +489,7 @@ CREATE TABLE `PREFIX_contact_lang` (
`id_lang` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL,
`name` varchar(32) NOT NULL, `name` varchar(32) NOT NULL,
`description` text, `description` text,
UNIQUE KEY `contact_lang_index` (`id_contact`,`id_lang`) PRIMARY KEY (`id_contact`,`id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_country` ( CREATE TABLE `PREFIX_country` (
@@ -513,7 +513,7 @@ CREATE TABLE `PREFIX_country_lang` (
`id_country` int(10) unsigned NOT NULL, `id_country` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL,
`name` varchar(64) NOT NULL, `name` varchar(64) NOT NULL,
UNIQUE KEY `country_lang_index` (`id_country`,`id_lang`) PRIMARY KEY (`id_country`,`id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_currency` ( CREATE TABLE `PREFIX_currency` (
@@ -574,7 +574,7 @@ CREATE TABLE `PREFIX_customer` (
CREATE TABLE `PREFIX_customer_group` ( CREATE TABLE `PREFIX_customer_group` (
`id_customer` int(10) unsigned NOT NULL, `id_customer` int(10) unsigned NOT NULL,
`id_group` int(10) unsigned NOT NULL, `id_group` int(10) unsigned NOT NULL,
PRIMARY KEY `customer_group_index` (`id_customer`,`id_group`), PRIMARY KEY (`id_customer`,`id_group`),
INDEX customer_login(id_group), INDEX customer_login(id_group),
KEY `id_customer` (`id_customer`) KEY `id_customer` (`id_customer`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
@@ -784,7 +784,7 @@ CREATE TABLE `PREFIX_group_lang` (
`id_group` int(10) unsigned NOT NULL, `id_group` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL,
`name` varchar(32) NOT NULL, `name` varchar(32) NOT NULL,
UNIQUE KEY `attribute_lang_index` (`id_group`,`id_lang`) PRIMARY KEY (`id_group`,`id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_group_reduction` ( CREATE TABLE `PREFIX_group_reduction` (
@@ -792,7 +792,7 @@ CREATE TABLE `PREFIX_group_reduction` (
`id_group` INT(10) UNSIGNED NOT NULL, `id_group` INT(10) UNSIGNED NOT NULL,
`id_category` INT(10) UNSIGNED NOT NULL, `id_category` INT(10) UNSIGNED NOT NULL,
`reduction` DECIMAL(4, 3) NOT NULL, `reduction` DECIMAL(4, 3) NOT NULL,
PRIMARY KEY(`id_group_reduction`), PRIMARY KEY (`id_group_reduction`),
UNIQUE KEY(`id_group`, `id_category`) UNIQUE KEY(`id_group`, `id_category`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
@@ -800,7 +800,7 @@ CREATE TABLE `PREFIX_product_group_reduction_cache` (
`id_product` INT UNSIGNED NOT NULL, `id_product` INT UNSIGNED NOT NULL,
`id_group` INT UNSIGNED NOT NULL, `id_group` INT UNSIGNED NOT NULL,
`reduction` DECIMAL(4, 3) NOT NULL, `reduction` DECIMAL(4, 3) NOT NULL,
PRIMARY KEY(`id_product`, `id_group`) PRIMARY KEY (`id_product`, `id_group`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_product_carrier` ( CREATE TABLE `PREFIX_product_carrier` (
@@ -888,7 +888,7 @@ CREATE TABLE `PREFIX_image_lang` (
`id_image` int(10) unsigned NOT NULL, `id_image` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL,
`legend` varchar(128) default NULL, `legend` varchar(128) default NULL,
UNIQUE KEY `image_lang_index` (`id_image`,`id_lang`), PRIMARY KEY (`id_image`,`id_lang`),
KEY `id_image` (`id_image`) KEY `id_image` (`id_image`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
@@ -1243,7 +1243,7 @@ CREATE TABLE `PREFIX_order_return_state_lang` (
`id_order_return_state` int(10) unsigned NOT NULL, `id_order_return_state` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL,
`name` varchar(64) NOT NULL, `name` varchar(64) NOT NULL,
UNIQUE KEY `order_state_lang_index` (`id_order_return_state`,`id_lang`) PRIMARY KEY (`id_order_return_state`,`id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_order_slip` ( CREATE TABLE `PREFIX_order_slip` (
@@ -1293,7 +1293,7 @@ CREATE TABLE `PREFIX_order_state_lang` (
`id_lang` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL,
`name` varchar(64) NOT NULL, `name` varchar(64) NOT NULL,
`template` varchar(64) NOT NULL, `template` varchar(64) NOT NULL,
UNIQUE KEY `order_state_lang_index` (`id_order_state`,`id_lang`) PRIMARY KEY (`id_order_state`,`id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_pack` ( CREATE TABLE `PREFIX_pack` (
@@ -1512,7 +1512,7 @@ CREATE TABLE `PREFIX_product_lang` (
`name` varchar(128) NOT NULL, `name` varchar(128) NOT NULL,
`available_now` varchar(255) default NULL, `available_now` varchar(255) default NULL,
`available_later` varchar(255) default NULL, `available_later` varchar(255) default NULL,
UNIQUE KEY `product_lang_index` (`id_product`, `id_shop` , `id_lang`), PRIMARY KEY (`id_product`, `id_shop` , `id_lang`),
KEY `id_lang` (`id_lang`), KEY `id_lang` (`id_lang`),
KEY `name` (`name`) KEY `name` (`name`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
@@ -1692,7 +1692,7 @@ CREATE TABLE `PREFIX_specific_price` (
`reduction_type` ENUM('amount', 'percentage') NOT NULL, `reduction_type` ENUM('amount', 'percentage') NOT NULL,
`from` DATETIME NOT NULL, `from` DATETIME NOT NULL,
`to` DATETIME NOT NULL, `to` DATETIME NOT NULL,
PRIMARY KEY(`id_specific_price`), PRIMARY KEY (`id_specific_price`),
KEY (`id_product`, `id_shop`, `id_currency`, `id_country`, `id_group`, `id_customer`, `from_quantity`, `from`, `to`), KEY (`id_product`, `id_shop`, `id_currency`, `id_country`, `id_group`, `id_customer`, `from_quantity`, `from`, `to`),
KEY `from_quantity` (`from_quantity`), KEY `from_quantity` (`from_quantity`),
KEY (`id_specific_price_rule`), KEY (`id_specific_price_rule`),
@@ -1773,13 +1773,13 @@ CREATE TABLE `PREFIX_tax_lang` (
`id_tax` int(10) unsigned NOT NULL, `id_tax` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL,
`name` varchar(32) NOT NULL, `name` varchar(32) NOT NULL,
UNIQUE KEY `tax_lang_index` (`id_tax`,`id_lang`) PRIMARY KEY (`id_tax`,`id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_timezone` ( CREATE TABLE `PREFIX_timezone` (
id_timezone int(10) unsigned NOT NULL auto_increment, id_timezone int(10) unsigned NOT NULL auto_increment,
name VARCHAR(32) NOT NULL, name VARCHAR(32) NOT NULL,
PRIMARY KEY timezone_index(`id_timezone`) PRIMARY KEY (`id_timezone`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_web_browser` ( CREATE TABLE `PREFIX_web_browser` (
@@ -1798,7 +1798,7 @@ CREATE TABLE `PREFIX_zone` (
CREATE TABLE `PREFIX_carrier_group` ( CREATE TABLE `PREFIX_carrier_group` (
`id_carrier` int(10) unsigned NOT NULL, `id_carrier` int(10) unsigned NOT NULL,
`id_group` int(10) unsigned NOT NULL, `id_group` int(10) unsigned NOT NULL,
UNIQUE KEY `id_carrier` (`id_carrier`,`id_group`) PRIMARY KEY (`id_carrier`,`id_group`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_store` ( CREATE TABLE `PREFIX_store` (
@@ -1866,7 +1866,7 @@ CREATE TABLE `PREFIX_product_country_tax` (
`id_product` int(11) NOT NULL, `id_product` int(11) NOT NULL,
`id_country` int(11) NOT NULL, `id_country` int(11) NOT NULL,
`id_tax` int(11) NOT NULL, `id_tax` int(11) NOT NULL,
UNIQUE KEY `id_product` (`id_product`,`id_country`) PRIMARY KEY (`id_product`,`id_country`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
@@ -28,16 +28,14 @@
function add_id_shop_to_shipper_lang_index() function add_id_shop_to_shipper_lang_index()
{ {
$res = true; $res = true;
$key_exists = Db::getInstance()->executeS('SHOW INDEX
$key_exists = Db::getInstance()->executeS('
SHOW INDEX
FROM `'._DB_PREFIX_.'carrier_lang` FROM `'._DB_PREFIX_.'carrier_lang`
WHERE Key_name = "shipper_lang_index"'); WHERE Key_name = "shipper_lang_index"');
if ($key_exists) if ($key_exists)
$res &= Db::getInstance()->execute('ALTER TABLE $res &= Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'carrier_lang` DROP KEY `shipper_lang_index`');
`'._DB_PREFIX_.'carrier_lang` $res &= Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'carrier_lang` ADD PRIMARY KEY (`id_carrier`, `id_shop`, `id_lang`)');
DROP KEY `shipper_lang_index`');
$res &= Db::getInstance()->execute('ALTER TABLE
`'._DB_PREFIX_.'carrier_lang`
ADD UNIQUE `shipper_lang_index` (`id_carrier`, `id_shop`, `id_lang`)');
return $res; return $res;
} }
+2
View File
@@ -6,3 +6,5 @@ ALTER TABLE `PREFIX_order_detail_tax` CHANGE `total_amount` `total_amount` DECIM
ALTER TABLE `PREFIX_customer_message` ADD `read` tinyint(1) NOT NULL default '0' AFTER `private`; ALTER TABLE `PREFIX_customer_message` ADD `read` tinyint(1) NOT NULL default '0' AFTER `private`;
INSERT INTO `PREFIX_configuration`(`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_ALLOW_MOBILE_DEVICE', '1', NOW(), NOW()); INSERT INTO `PREFIX_configuration`(`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_ALLOW_MOBILE_DEVICE', '1', NOW(), NOW());
/* PHP:p15017_add_id_shop_to_primary_key(); */;