llx_commande.key.sql 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. -- ============================================================================
  2. -- Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
  3. -- Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
  4. --
  5. -- This program is free software; you can redistribute it and/or modify
  6. -- it under the terms of the GNU General Public License as published by
  7. -- the Free Software Foundation; either version 3 of the License, or
  8. -- (at your option) any later version.
  9. --
  10. -- This program is distributed in the hope that it will be useful,
  11. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. -- GNU General Public License for more details.
  14. --
  15. -- You should have received a copy of the GNU General Public License
  16. -- along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. --
  18. -- ============================================================================
  19. -- Delete orphans
  20. -- V4 DELETE llx_commande FROM llx_commande LEFT JOIN llx_societe ON llx_commande.fk_soc = llx_societe.rowid WHERE llx_societe.rowid IS NULL;
  21. ALTER TABLE llx_commande ADD UNIQUE INDEX uk_commande_ref (ref, entity);
  22. ALTER TABLE llx_commande ADD INDEX idx_commande_fk_soc (fk_soc);
  23. ALTER TABLE llx_commande ADD INDEX idx_commande_fk_user_author (fk_user_author);
  24. ALTER TABLE llx_commande ADD INDEX idx_commande_fk_user_valid (fk_user_valid);
  25. ALTER TABLE llx_commande ADD INDEX idx_commande_fk_user_cloture (fk_user_cloture);
  26. ALTER TABLE llx_commande ADD INDEX idx_commande_fk_projet (fk_projet);
  27. ALTER TABLE llx_commande ADD INDEX idx_commande_fk_account(fk_account);
  28. ALTER TABLE llx_commande ADD INDEX idx_commande_fk_currency(fk_currency);
  29. ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
  30. ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
  31. ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
  32. ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_user_cloture FOREIGN KEY (fk_user_cloture) REFERENCES llx_user (rowid);
  33. ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);