Skip to content

Commit

Permalink
Fix: disable foreign key checks for external modules constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Mar 13, 2012
1 parent dabd8e4 commit dcf7220
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions htdocs/install/mysql/migration/3.1.0-3.2.0.sql
Expand Up @@ -271,6 +271,9 @@ ALTER TABLE llx_adherent_extrafields ADD COLUMN import_key varchar(14);
ALTER TABLE llx_product_extrafields ADD COLUMN import_key varchar(14);
ALTER TABLE llx_societe_extrafields ADD COLUMN import_key varchar(14);

-- Disable foreign key checks for external modules constraints
SET FOREIGN_KEY_CHECKS=0;

DROP TABLE llx_c_currencies;
create table llx_c_currencies
(
Expand Down Expand Up @@ -422,6 +425,8 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XEU'
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARP', NULL, 0, 'Pesos argentins');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXP', NULL, 0, 'Pesos Mexicans');

SET FOREIGN_KEY_CHECKS=1;

ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso);
ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso);
Expand Down

0 comments on commit dcf7220

Please sign in to comment.