diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql
index 071bd3afb4dd9cdef81a68ee2850f4d5b857b95f..e29053add3b8036c2fd52c1afde9e3ac37c22620 100755
--- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql
+++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql
@@ -119,6 +119,16 @@ ALTER TABLE llx_societe ADD COLUMN fk_barcode_type integer DEFAULT 0;
 
 UPDATE llx_menu SET leftmenu = NULL where leftmenu in ('', '0', '1');
 
+ALTER TABLE llx_categorie_societe DROP INDEX fk_categorie;
+ALTER TABLE llx_categorie_societe DROP INDEX fk_societe;
+
+ALTER TABLE llx_categorie_fournisseur DROP INDEX fk_categorie;
+ALTER TABLE llx_categorie_fournisseur ADD PRIMARY KEY pk_categorie_fournisseur (fk_categorie, fk_societe);
+ALTER TABLE llx_categorie_fournisseur ADD INDEX idx_categorie_fournisseur_fk_categorie (fk_categorie);
+ALTER TABLE llx_categorie_fournisseur ADD INDEX idx_categorie_fournisseur_fk_societe (fk_societe);
+ALTER TABLE llx_categorie_fournisseur ADD CONSTRAINT fk_categorie_fournisseur_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
+ALTER TABLE llx_categorie_fournisseur ADD CONSTRAINT fk_categorie_fournisseur_fk_soc   FOREIGN KEY (fk_societe) REFERENCES llx_societe (rowid);
+
 -- Regions Venezuela (id country=232)
 INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23201,  232, 23201, '', 0, 'Los Andes', 1);
 INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23202,  232, 23202, '', 0, 'Capital', 1);
diff --git a/htdocs/install/mysql/tables/llx_categorie_fournisseur.key.sql b/htdocs/install/mysql/tables/llx_categorie_fournisseur.key.sql
index 0e5bde492d8a3a9e8a12d01dbc7c092541cbd34e..63f0e280a4756fdcd994ba4af862dd781f52aa0a 100644
--- a/htdocs/install/mysql/tables/llx_categorie_fournisseur.key.sql
+++ b/htdocs/install/mysql/tables/llx_categorie_fournisseur.key.sql
@@ -1,5 +1,6 @@
 -- ============================================================================
--- Copyright (C) 2007 Patrick Raguin       <patrick.raguin@gmail.com>
+-- Copyright (C) 2012 Laurent Destailleur	<eldy@users.sourceforge.net>
+-- Copyright (C) 2012 Regis Houssin			<regis@dolibarr.fr>
 --
 -- This program is free software; you can redistribute it and/or modify
 -- it under the terms of the GNU General Public License as published by
diff --git a/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql b/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql
index e8d39125e01de1de13f696b69d003d2d0cab173f..535972686c22ce7af600bb85af0e94642da49411 100644
--- a/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql
+++ b/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql
@@ -1,5 +1,7 @@
 -- ============================================================================
--- Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+-- Copyright (C) 2006 Rodolphe Quiedeville	<rodolphe@quiedeville.org>
+-- Copyright (C) 2012 Laurent Destailleur	<eldy@users.sourceforge.net>
+-- Copyright (C) 2012 Regis Houssin			<regis@dolibarr.fr>
 --
 -- This program is free software; you can redistribute it and/or modify
 -- it under the terms of the GNU General Public License as published by
@@ -19,6 +21,5 @@
 create table llx_categorie_fournisseur
 (
   fk_categorie  integer NOT NULL,
-  fk_societe    integer NOT NULL,
-  UNIQUE (fk_categorie, fk_societe)
+  fk_societe    integer NOT NULL
 )ENGINE=innodb;