From 30c03547fa77a96e7807deed1d3e17b5a9447d9b Mon Sep 17 00:00:00 2001 From: dMetzger Date: Wed, 12 Sep 2012 14:00:29 +0000 Subject: [PATCH] // [-] 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@17305 b9a71923-0436-4b27-9f14-aed3839534dd --- .../php/p15017_add_id_shop_to_primary_key.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 install-dev/upgrade/php/p15017_add_id_shop_to_primary_key.php diff --git a/install-dev/upgrade/php/p15017_add_id_shop_to_primary_key.php b/install-dev/upgrade/php/p15017_add_id_shop_to_primary_key.php new file mode 100644 index 000000000..964da1b6a --- /dev/null +++ b/install-dev/upgrade/php/p15017_add_id_shop_to_primary_key.php @@ -0,0 +1,38 @@ + +* @copyright 2007-2012 PrestaShop SA +* @version Release: $Revision: 13573 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function p15017_add_id_shop_to_primary_key() +{ + // The former primary keys where set on id_object and id_lang. They must now be set on id_shop too. + foreach (array('product', 'category', 'meta', 'carrier') as $table) + { + Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.$table.'_lang` DROP PRIMARY KEY'); + Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.$table.'_lang` ADD PRIMARY KEY (`id_'.$table.'`, `id_shop`, `id_lang`)'); + } + + return true; +}