llx_product.key.sql 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_ref (ref, entity);
  23. ALTER TABLE llx_product ADD INDEX idx_product_label (label);
  24. ALTER TABLE llx_product ADD INDEX idx_product_barcode (barcode);
  25. ALTER TABLE llx_product ADD INDEX idx_product_import_key (import_key);
  26. ALTER TABLE llx_product ADD INDEX idx_product_seuil_stock_alerte (seuil_stock_alerte);
  27. ALTER TABLE llx_product ADD INDEX idx_product_fk_country (fk_country);
  28. ALTER TABLE llx_product ADD INDEX idx_product_fk_user_author (fk_user_author);
  29. ALTER TABLE llx_product ADD INDEX idx_product_fk_barcode_type (fk_barcode_type);
  30. ALTER TABLE llx_product ADD INDEX idx_product_fk_project (fk_project);
  31. ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_barcode (barcode, fk_barcode_type, entity);
  32. ALTER TABLE llx_product ADD CONSTRAINT fk_product_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
  33. ALTER TABLE llx_product ADD CONSTRAINT fk_product_finished FOREIGN KEY (finished) REFERENCES llx_c_product_nature (code);
  34. ALTER TABLE llx_product ADD CONSTRAINT fk_product_fk_country FOREIGN KEY (fk_country) REFERENCES llx_c_country (rowid);
  35. ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid);
  36. ALTER TABLE llx_product ADD CONSTRAINT fk_product_default_warehouse FOREIGN KEY (fk_default_warehouse) REFERENCES llx_entrepot (rowid);