diff --git a/mysql/tables/llx_c_regions.key.sql b/mysql/tables/llx_c_regions.key.sql new file mode 100644 index 0000000000000000000000000000000000000000..d0b279718bc4d9f65abb8c45ab4ed3d23c3a5e62 --- /dev/null +++ b/mysql/tables/llx_c_regions.key.sql @@ -0,0 +1,24 @@ +-- ======================================================================== +-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> +-- +-- $Id$ +-- $Source$ +-- +-- 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 +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- ======================================================================== + + +ALTER TABLE llx_c_regions ADD CONSTRAINT c_regions_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_pays (rowid); diff --git a/mysql/tables/llx_facture.key.sql b/mysql/tables/llx_facture.key.sql index 05ee11aa91423b210aaf00fddc5171469eddc5cf..f2cfc9d9812d730365b57a972003e626e9343a62 100644 --- a/mysql/tables/llx_facture.key.sql +++ b/mysql/tables/llx_facture.key.sql @@ -21,14 +21,11 @@ -- -- ============================================================================ --- --- ALTER TABLE llx_facture ADD INDEX (fk_soc); ALTER TABLE llx_facture ADD INDEX (fk_user_author); ALTER TABLE llx_facture ADD INDEX (fk_user_valid); --- --- + ALTER TABLE llx_facture ADD FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); ALTER TABLE llx_facture ADD FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); diff --git a/mysql/tables/llx_facture_tva_sum.key.sql b/mysql/tables/llx_facture_tva_sum.key.sql new file mode 100644 index 0000000000000000000000000000000000000000..3518953e56d191653c0024ea96ffa7bf59e8a5f5 --- /dev/null +++ b/mysql/tables/llx_facture_tva_sum.key.sql @@ -0,0 +1,25 @@ +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> +-- +-- 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 +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- =================================================================== + +-- Supprimme orhpelins pour permettre mont�e de la cl� +DELETE llx_facture_tva_sum FROM llx_facture_tva_sum LEFT JOIN llx_facture ON llx_facture_tva_sum.fk_facture = llx_facture.rowid WHERE llx_facture.rowid IS NULL; + +ALTER TABLE llx_facture_tva_sum ADD CONSTRAINT facture_tva_sum_fk_facture_rowid FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid); diff --git a/mysql/tables/llx_facturedet.key.sql b/mysql/tables/llx_facturedet.key.sql new file mode 100644 index 0000000000000000000000000000000000000000..60ba36e82e04de35667c4aa468fa67786ba51175 --- /dev/null +++ b/mysql/tables/llx_facturedet.key.sql @@ -0,0 +1,25 @@ +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> +-- +-- 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 +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- =================================================================== + +-- Supprimme orhpelins pour permettre mont�e de la cl� +DELETE llx_facturedet FROM llx_facturedet LEFT JOIN llx_facture ON llx_facturedet.fk_facture = llx_facture.rowid WHERE llx_facture.rowid IS NULL; + +ALTER TABLE llx_facturedet ADD CONSTRAINT facturedet_fk_facture_rowid FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid); diff --git a/mysql/tables/llx_fichinter.key.sql b/mysql/tables/llx_fichinter.key.sql new file mode 100644 index 0000000000000000000000000000000000000000..70152fea4ed85f876c0b1ef5c91d119c81cc92e2 --- /dev/null +++ b/mysql/tables/llx_fichinter.key.sql @@ -0,0 +1,23 @@ +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> +-- +-- 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 +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- +-- =================================================================== + +ALTER TABLE llx_fichinter ADD CONSTRAINT fichinter_fk_soc_idp FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); diff --git a/mysql/tables/llx_paiement_facture.key.sql b/mysql/tables/llx_paiement_facture.key.sql new file mode 100644 index 0000000000000000000000000000000000000000..2aeb16bf352245e026a0dc5e71de0e5b5b698b7f --- /dev/null +++ b/mysql/tables/llx_paiement_facture.key.sql @@ -0,0 +1,28 @@ +-- ============================================================================ +-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> +-- +-- 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 +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- +-- =========================================================================== + +-- Supprimme orhpelins pour permettre mont�e de la cl� +DELETE llx_paiement_facture FROM llx_paiement_facture LEFT JOIN llx_facture ON llx_paiement_facture.fk_facture = llx_facture.rowid WHERE llx_facture.rowid IS NULL; +DELETE llx_paiement_facture FROM llx_paiement_facture LEFT JOIn llx_paiement ON llx_paiement_facture.fk_facture = llx_paiement.rowid WHERE llx_paiement.rowid IS NULL; + +ALTER TABLE llx_paiement_facture ADD CONSTRAINT paiement_facture_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid); +ALTER TABLE llx_paiement_facture ADD CONSTRAINT paiement_facture_fk_paiement FOREIGN KEY (fk_paiement) REFERENCES llx_paiement (rowid); diff --git a/mysql/tables/llx_propal.key.sql b/mysql/tables/llx_propal.key.sql index f107954856cb8351efaf42e9e578a1bfeb328ceb..bc11a38eecea3605ce7d5375b39812ba5c801643 100644 --- a/mysql/tables/llx_propal.key.sql +++ b/mysql/tables/llx_propal.key.sql @@ -21,10 +21,7 @@ -- -- ============================================================================ --- --- ALTER TABLE llx_propal ADD INDEX (fk_soc); --- --- + ALTER TABLE llx_propal ADD FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); diff --git a/mysql/tables/llx_socpeople.key.sql b/mysql/tables/llx_socpeople.key.sql new file mode 100644 index 0000000000000000000000000000000000000000..35416782bb54acb41f0ebbe3dc6cd51e66f289e2 --- /dev/null +++ b/mysql/tables/llx_socpeople.key.sql @@ -0,0 +1,24 @@ +-- ============================================================================ +-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> +-- +-- 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 +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- +-- ============================================================================ + + +ALTER TABLE llx_socpeople ADD CONSTRAINT socpeople_fk_soc_idp FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); diff --git a/mysql/tables/llx_usergroup_rights.key.sql b/mysql/tables/llx_usergroup_rights.key.sql index 8819913dd49d5116cdc7470b6210fa30070a489f..0c6fcda225cc5a8a1f90d154db5e92e25c28251c 100644 --- a/mysql/tables/llx_usergroup_rights.key.sql +++ b/mysql/tables/llx_usergroup_rights.key.sql @@ -21,9 +21,6 @@ -- =========================================================================== -- Supprimme orhpelins pour permettre mont�e de la cl� -delete llx_usergroup_rights -from llx_usergroup_rights -left join llx_usergroup on llx_usergroup_rights.fk_user = llx_usergroup.rowid -where llx_usergroup.rowid is null; +DELETE llx_usergroup_rights FROM llx_usergroup_rights LEFT JOIN llx_usergroup ON llx_usergroup_rights.fk_user = llx_usergroup.rowid WHERE llx_usergroup.rowid IS NULL; ALTER TABLE llx_usergroup_rights ADD FOREIGN KEY (fk_usergroup) REFERENCES llx_usergroup (rowid);