1-- ============================================================================
2-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3-- Copyright (C) 2004-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
4-- Copyright (C) 2005-2009 Regis Houssin        <regis.houssin@inodbox.com>
5-- Copyright (C) 2012      Cédric Salvador      <csalvador@gpcsolutions.fr>
6-- Copyright (C) 2014      Marcos García        <marcosgdf@gmail.com>
7--
8-- This program is free software; you can redistribute it and/or modify
9-- it under the terms of the GNU General Public License as published by
10-- the Free Software Foundation; either version 3 of the License, or
11-- (at your option) any later version.
12--
13-- This program is distributed in the hope that it will be useful,
14-- but WITHOUT ANY WARRANTY; without even the implied warranty of
15-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16-- GNU General Public License for more details.
17--
18-- You should have received a copy of the GNU General Public License
19-- along with this program. If not, see <https://www.gnu.org/licenses/>.
20--
21-- ============================================================================
22
23
24ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_ref (ref, entity);
25
26ALTER TABLE llx_product ADD INDEX idx_product_label (label);
27ALTER TABLE llx_product ADD INDEX idx_product_barcode (barcode);
28ALTER TABLE llx_product ADD INDEX idx_product_import_key (import_key);
29ALTER TABLE llx_product ADD INDEX idx_product_seuil_stock_alerte (seuil_stock_alerte);
30ALTER TABLE llx_product ADD INDEX idx_product_fk_country (fk_country);
31ALTER TABLE llx_product ADD INDEX idx_product_fk_user_author (fk_user_author);
32ALTER TABLE llx_product ADD INDEX idx_product_fk_barcode_type (fk_barcode_type);
33ALTER TABLE llx_product ADD INDEX idx_product_fk_project (fk_project);
34ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_barcode (barcode, fk_barcode_type, entity);
35ALTER TABLE llx_product ADD CONSTRAINT fk_product_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
36ALTER TABLE llx_product ADD CONSTRAINT fk_product_finished FOREIGN KEY (finished) REFERENCES llx_c_product_nature (code);
37
38ALTER TABLE  llx_product ADD CONSTRAINT fk_product_fk_country FOREIGN KEY (fk_country) REFERENCES  llx_c_country (rowid);
39ALTER TABLE  llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES  llx_c_barcode_type (rowid);
40ALTER TABLE  llx_product ADD CONSTRAINT fk_product_default_warehouse FOREIGN KEY (fk_default_warehouse) REFERENCES llx_entrepot (rowid);
41