Qual: Ajout index et contraintes sur commandes
This commit is contained in:
parent
2fe1b0dfc9
commit
1290851ac2
@ -84,9 +84,17 @@ ALTER TABLE `llx_commande` ADD `date_livraison` DATE;
|
||||
ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_facture (fk_facture_fourn);
|
||||
ALTER TABLE llx_facture_fourn_det ADD CONSTRAINT fk_facture_fourn_det_fk_facture FOREIGN KEY (fk_facture_fourn) REFERENCES llx_facture_fourn (rowid);
|
||||
|
||||
|
||||
ALTER TABLE llx_commande ADD INDEX idx_commande_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
|
||||
|
||||
ALTER TABLE llx_commande_fournisseur ADD INDEX idx_commande_fournisseur_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_commande_fournisseur ADD CONSTRAINT fk_commande_fournisseur_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
|
||||
|
||||
|
||||
create table llx_avoir_model_pdf
|
||||
(
|
||||
nom varchar(50) PRIMARY KEY,
|
||||
libelle varchar(255),
|
||||
description text
|
||||
)type=innodb;
|
||||
)type=innodb;
|
||||
|
||||
28
mysql/tables/llx_commande.key.sql
Normal file
28
mysql/tables/llx_commande.key.sql
Normal file
@ -0,0 +1,28 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2006 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 orphelins pour permettre montée de la clé
|
||||
-- V4 DELETE llx_commande FROM llx_commande LEFT JOIN llx_societe ON llx_commande.fk_soc = llx_societe.idp WHERE llx_societe.idp IS NULL;
|
||||
|
||||
ALTER TABLE llx_commande ADD INDEX idx_commande_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
|
||||
@ -24,7 +24,7 @@ create table llx_commande
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
fk_soc integer,
|
||||
fk_soc integer NOT NULL,
|
||||
fk_soc_contact integer,
|
||||
fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande
|
||||
ref varchar(30) NOT NULL, -- order number
|
||||
@ -35,7 +35,7 @@ create table llx_commande
|
||||
date_commande date, -- date de la commande
|
||||
fk_user_author integer, -- createur de la commande
|
||||
fk_user_valid integer, -- valideur de la commande
|
||||
fk_user_cloture integer, -- cloture de la propale signee ou non signee
|
||||
fk_user_cloture integer, -- auteur cloture
|
||||
source smallint NOT NULL,
|
||||
fk_statut smallint default 0,
|
||||
amount_ht real default 0,
|
||||
@ -47,9 +47,11 @@ create table llx_commande
|
||||
note text,
|
||||
note_public text,
|
||||
model_pdf varchar(50),
|
||||
|
||||
facture tinyint default 0,
|
||||
fk_cond_reglement integer, -- condition de réglement
|
||||
fk_mode_reglement integer, -- mode de réglement
|
||||
date_livraison date default NULL,
|
||||
date_livraison date default NULL,
|
||||
|
||||
UNIQUE INDEX (ref)
|
||||
)type=innodb;
|
||||
|
||||
28
mysql/tables/llx_commande_fournisseur.key.sql
Normal file
28
mysql/tables/llx_commande_fournisseur.key.sql
Normal file
@ -0,0 +1,28 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2006 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 orphelins pour permettre montée de la clé
|
||||
-- V4 DELETE llx_commande_fournisseur FROM llx_commande_fournisseur LEFT JOIN llx_societe ON llx_commande_fournisseur.fk_soc = llx_societe.idp WHERE llx_societe.idp IS NULL;
|
||||
|
||||
ALTER TABLE llx_commande_fournisseur ADD INDEX idx_commande_fournisseur_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_commande_fournisseur ADD CONSTRAINT fk_commande_fournisseur_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
|
||||
@ -24,18 +24,18 @@ create table llx_commande_fournisseur
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
fk_soc integer,
|
||||
fk_soc integer NOT NULL,
|
||||
fk_soc_contact integer,
|
||||
fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande
|
||||
ref varchar(30) NOT NULL, -- propal number
|
||||
ref varchar(30) NOT NULL, -- order number
|
||||
|
||||
date_creation datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
date_cloture datetime, -- date de cloture
|
||||
date_commande date, -- date de la commande
|
||||
fk_methode_commande integer default 0,
|
||||
fk_user_author integer, -- createur de la commande
|
||||
fk_user_valid integer, -- valideur de la commande
|
||||
fk_user_cloture integer, -- cloture de la propale signee ou non signee
|
||||
fk_user_cloture integer, -- auteur cloture
|
||||
source smallint NOT NULL,
|
||||
fk_statut smallint default 0,
|
||||
amount_ht real default 0,
|
||||
@ -45,7 +45,10 @@ create table llx_commande_fournisseur
|
||||
total_ht real default 0,
|
||||
total_ttc real default 0,
|
||||
note text,
|
||||
note_public text,
|
||||
model_pdf varchar(50),
|
||||
|
||||
fk_methode_commande integer default 0,
|
||||
|
||||
UNIQUE INDEX (ref)
|
||||
)type=innodb;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user