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 071bd3afb4d..e29053add3b 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 0e5bde492d8..63f0e280a47 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 +-- Copyright (C) 2012 Laurent Destailleur +-- Copyright (C) 2012 Regis Houssin -- -- 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 e8d39125e01..535972686c2 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 +-- Copyright (C) 2006 Rodolphe Quiedeville +-- Copyright (C) 2012 Laurent Destailleur +-- Copyright (C) 2012 Regis Houssin -- -- 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;