From 43329f7ec5f38368318f4352478c523bd676755d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 May 2006 13:27:02 +0000 Subject: [PATCH] Mise a jour script postgresql --- pgsql/tables/Makefile | 77 ---------- pgsql/tables/llx_accountingaccount.key.sql | 31 ++++ ...stem_det.sql => llx_accountingaccount.sql} | 5 +- ...x_auteur.sql => llx_accountingdebcred.sql} | 14 +- pgsql/tables/llx_accountingsystem.sql | 3 +- pgsql/tables/llx_accountingtransaction.sql | 37 +++++ pgsql/tables/llx_actioncomm.sql | 6 +- pgsql/tables/llx_bank_account.sql | 3 +- pgsql/tables/llx_categorie.sql | 10 +- pgsql/tables/llx_comfourn_facfourn.sql | 36 +++++ pgsql/tables/llx_commande.key.sql | 32 ++++ pgsql/tables/llx_commande.sql | 56 ++++--- pgsql/tables/llx_commande_fournisseur.key.sql | 32 ++++ pgsql/tables/llx_commande_fournisseur.sql | 11 +- pgsql/tables/llx_commandedet.sql | 3 +- pgsql/tables/llx_cond_reglement.sql | 76 ++++----- pgsql/tables/llx_contrat.key.sql | 4 +- pgsql/tables/llx_contrat.sql | 4 +- pgsql/tables/llx_document_model.sql | 36 +++++ pgsql/tables/llx_facture.key.sql | 2 + pgsql/tables/llx_facture.sql | 19 ++- pgsql/tables/llx_facture_fourn_det.key.sql | 31 ++++ ...{llx_livre.sql => llx_facture_rec.key.sql} | 27 +--- pgsql/tables/llx_facture_rec.sql | 5 + ...re_to_auteur.sql => llx_facture_stats.sql} | 16 +- pgsql/tables/llx_facturedet.sql | 1 + pgsql/tables/llx_livraison.key.sql | 32 ++++ pgsql/tables/llx_livraison.sql | 52 +++++++ ...ystem_det.key.sql => llx_livraisondet.sql} | 19 ++- pgsql/tables/llx_paiementfourn.sql | 3 +- .../llx_paiementfourn_facturefourn.key.sql | 29 ++++ .../tables/llx_paiementfourn_facturefourn.sql | 70 +++++---- pgsql/tables/llx_product.sql | 3 +- ...x_lieu_concert.sql => llx_product_det.sql} | 15 +- pgsql/tables/llx_projet_task_actors.sql | 76 ++++----- pgsql/tables/llx_projet_task_time.sql | 80 +++++----- pgsql/tables/llx_propal.sql | 12 +- pgsql/tables/llx_societe.sql | 144 +++++++++--------- .../tables/llx_societe_adresse_livraison.sql | 44 ++++++ 39 files changed, 745 insertions(+), 411 deletions(-) delete mode 100644 pgsql/tables/Makefile create mode 100644 pgsql/tables/llx_accountingaccount.key.sql rename pgsql/tables/{llx_accountingsystem_det.sql => llx_accountingaccount.sql} (89%) rename pgsql/tables/{llx_auteur.sql => llx_accountingdebcred.sql} (77%) create mode 100644 pgsql/tables/llx_accountingtransaction.sql create mode 100644 pgsql/tables/llx_comfourn_facfourn.sql create mode 100644 pgsql/tables/llx_commande.key.sql create mode 100644 pgsql/tables/llx_commande_fournisseur.key.sql create mode 100644 pgsql/tables/llx_document_model.sql create mode 100644 pgsql/tables/llx_facture_fourn_det.key.sql rename pgsql/tables/{llx_livre.sql => llx_facture_rec.key.sql} (57%) rename pgsql/tables/{llx_livre_to_auteur.sql => llx_facture_stats.sql} (78%) create mode 100644 pgsql/tables/llx_livraison.key.sql create mode 100644 pgsql/tables/llx_livraison.sql rename pgsql/tables/{llx_accountingsystem_det.key.sql => llx_livraisondet.sql} (71%) create mode 100644 pgsql/tables/llx_paiementfourn_facturefourn.key.sql rename pgsql/tables/{llx_lieu_concert.sql => llx_product_det.sql} (75%) create mode 100644 pgsql/tables/llx_societe_adresse_livraison.sql diff --git a/pgsql/tables/Makefile b/pgsql/tables/Makefile deleted file mode 100644 index 1b50e7c0f86..00000000000 --- a/pgsql/tables/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# -# Copyright (C) 2001-2002 Rodolphe Quiedeville -# Copyright (C) 2002-2003 Éric Seigne -# Copyright (C) 2004 Benoit Mortier -# -# $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. -# -SQL=psql -BASE=dolibarr -OWNER=dolibarradm -OPTIONS=-U $(OWNER) - -all: show - -create: - $(SQL) $(OPTIONS) $(BASE) < actioncomm.sql - $(SQL) $(OPTIONS) $(BASE) < c_actioncomm.sql - $(SQL) $(OPTIONS) $(BASE) < c_chargesociales.sql - $(SQL) $(OPTIONS) $(BASE) < c_effectif.sql - $(SQL) $(OPTIONS) $(BASE) < c_paiement.sql - $(SQL) $(OPTIONS) $(BASE) < c_pays.sql - $(SQL) $(OPTIONS) $(BASE) < c_propalst.sql - $(SQL) $(OPTIONS) $(BASE) < c_stcomm.sql - $(SQL) $(OPTIONS) $(BASE) < c_typent.sql - $(SQL) $(OPTIONS) $(BASE) < llx_adherent.sql - $(SQL) $(OPTIONS) $(BASE) < llx_bank.sql - $(SQL) $(OPTIONS) $(BASE) < llx_bank_account.sql - $(SQL) $(OPTIONS) $(BASE) < llx_bank_categ.sql - $(SQL) $(OPTIONS) $(BASE) < llx_bank_class.sql - $(SQL) $(OPTIONS) $(BASE) < llx_bookmark.sql - $(SQL) $(OPTIONS) $(BASE) < llx_chargesociales.sql - $(SQL) $(OPTIONS) $(BASE) < llx_compta.sql - $(SQL) $(OPTIONS) $(BASE) < llx_compta_account.sql - $(SQL) $(OPTIONS) $(BASE) < llx_cotisation.sql - $(SQL) $(OPTIONS) $(BASE) < llx_don.sql - $(SQL) $(OPTIONS) $(BASE) < llx_don_projet.sql - $(SQL) $(OPTIONS) $(BASE) < llx_fa_pr.sql - $(SQL) $(OPTIONS) $(BASE) < llx_facture.sql - $(SQL) $(OPTIONS) $(BASE) < llx_facture_fourn.sql - $(SQL) $(OPTIONS) $(BASE) < llx_fichinter.sql - $(SQL) $(OPTIONS) $(BASE) < llx_paiement.sql - $(SQL) $(OPTIONS) $(BASE) < llx_pointmort.sql - $(SQL) $(OPTIONS) $(BASE) < llx_product.sql - $(SQL) $(OPTIONS) $(BASE) < llx_projet.sql - $(SQL) $(OPTIONS) $(BASE) < llx_propal.sql - $(SQL) $(OPTIONS) $(BASE) < llx_propaldet.sql - $(SQL) $(OPTIONS) $(BASE) < llx_service.sql - $(SQL) $(OPTIONS) $(BASE) < llx_soc_recontact.sql - $(SQL) $(OPTIONS) $(BASE) < llx_tva.sql - $(SQL) $(OPTIONS) $(BASE) < llx_user.sql - $(SQL) $(OPTIONS) $(BASE) < llx_ventes.sql - $(SQL) $(OPTIONS) $(BASE) < llx_voyage.sql - $(SQL) $(OPTIONS) $(BASE) < llx_voyage_reduc.sql - $(SQL) $(OPTIONS) $(BASE) < societe.sql - $(SQL) $(OPTIONS) $(BASE) < socpeople.sql - $(SQL) $(OPTIONS) $(BASE) < socstatutlog.sql - -drop: - $(SQL) $(OPTIONS) $(BASE) < drop.sql - -show: - $(SQL) $(OPTIONS) $(BASE) -c '\d' diff --git a/pgsql/tables/llx_accountingaccount.key.sql b/pgsql/tables/llx_accountingaccount.key.sql new file mode 100644 index 00000000000..243e8351274 --- /dev/null +++ b/pgsql/tables/llx_accountingaccount.key.sql @@ -0,0 +1,31 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2005-2006 Laurent Destailleur +-- +-- 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_accountingaccount ADD INDEX idx_accountingaccount_fk_pcg_version (fk_pcg_version); + + +ALTER TABLE llx_accountingaccount ADD CONSTRAINT fk_accountingaccount_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accountingsystem (pcg_version); diff --git a/pgsql/tables/llx_accountingsystem_det.sql b/pgsql/tables/llx_accountingaccount.sql similarity index 89% rename from pgsql/tables/llx_accountingsystem_det.sql rename to pgsql/tables/llx_accountingaccount.sql index 8a5f9c94c2c..4c792346bdc 100644 --- a/pgsql/tables/llx_accountingsystem_det.sql +++ b/pgsql/tables/llx_accountingaccount.sql @@ -3,7 +3,7 @@ -- (c) 2005, Laurent Destailleur. -- ============================================================================ --- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2004-2006 Laurent Destailleur -- -- 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 @@ -21,10 +21,9 @@ -- -- $Id$ -- $Source$ --- -- ============================================================================ -create table llx_accountingsystem_det +create table llx_accountingaccount ( rowid SERIAL PRIMARY KEY, "fk_pcg_version" varchar(12) NOT NULL, diff --git a/pgsql/tables/llx_auteur.sql b/pgsql/tables/llx_accountingdebcred.sql similarity index 77% rename from pgsql/tables/llx_auteur.sql rename to pgsql/tables/llx_accountingdebcred.sql index 0a7f3fbea9c..89daac20f3c 100644 --- a/pgsql/tables/llx_auteur.sql +++ b/pgsql/tables/llx_accountingdebcred.sql @@ -3,7 +3,7 @@ -- (c) 2005, Laurent Destailleur. -- ============================================================================ --- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2004-2006 Laurent Destailleur -- -- 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 @@ -21,14 +21,12 @@ -- -- $Id$ -- $Source$ --- -- ============================================================================ -create table llx_auteur +create table llx_accountingdebcred ( - rowid SERIAL PRIMARY KEY, - "oscid" integer NOT NULL, - "tms" timestamp, - "nom" varchar(255), - "fk_user_author" integer + "fk_transaction" integer NOT NULL, + "fk_account" integer NOT NULL, + "amount" real NOT NULL, + "direction" varchar(1) NOT NULL ); diff --git a/pgsql/tables/llx_accountingsystem.sql b/pgsql/tables/llx_accountingsystem.sql index 14be5c83571..1258b76c9ed 100644 --- a/pgsql/tables/llx_accountingsystem.sql +++ b/pgsql/tables/llx_accountingsystem.sql @@ -3,7 +3,7 @@ -- (c) 2005, Laurent Destailleur. -- ============================================================================ --- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2004-2006 Laurent Destailleur -- -- 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 @@ -21,7 +21,6 @@ -- -- $Id$ -- $Source$ --- -- ============================================================================ create table llx_accountingsystem diff --git a/pgsql/tables/llx_accountingtransaction.sql b/pgsql/tables/llx_accountingtransaction.sql new file mode 100644 index 00000000000..38d05310c78 --- /dev/null +++ b/pgsql/tables/llx_accountingtransaction.sql @@ -0,0 +1,37 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2004-2006 Laurent Destailleur +-- +-- 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$ +-- ============================================================================ + +create table llx_accountingtransaction +( + rowid SERIAL PRIMARY KEY, + "label" varchar(128) NOT NULL, + "datec" date NOT NULL, + "fk_author" varchar(20) NOT NULL, + "tms" timestamp, + "fk_facture" integer, + "fk_facture_fourn" integer, + "fk_paiement" integer, + "fk_paiement_fourn" integer +); diff --git a/pgsql/tables/llx_actioncomm.sql b/pgsql/tables/llx_actioncomm.sql index 39dfa360b8f..b0faa459e3a 100644 --- a/pgsql/tables/llx_actioncomm.sql +++ b/pgsql/tables/llx_actioncomm.sql @@ -30,7 +30,10 @@ create table llx_actioncomm ( id SERIAL PRIMARY KEY, - "datea" timestamp, -- action date + "datec" timestamp, -- date creation + "datep" timestamp, -- date 0% + "datea" timestamp, -- date 100% + "tms" timestamp, -- date modif "fk_action" integer, "label" varchar(50) NOT NULL, -- libelle de l'action "fk_soc" integer, @@ -41,6 +44,7 @@ create table llx_actioncomm "percent" smallint NOT NULL default 0, "note" text, "propalrowid" integer, + "fk_commande" integer, "fk_facture" integer ); diff --git a/pgsql/tables/llx_bank_account.sql b/pgsql/tables/llx_bank_account.sql index 8ffbb6a11ba..449f69d2b4c 100644 --- a/pgsql/tables/llx_bank_account.sql +++ b/pgsql/tables/llx_bank_account.sql @@ -34,7 +34,8 @@ create table llx_bank_account rowid SERIAL PRIMARY KEY, "datec" timestamp, "tms" timestamp, - "label" varchar(30), + "ref" varchar(12) NOT NULL, + "label" varchar(30) NOT NULL, "bank" varchar(60), "code_banque" varchar(7), "code_guichet" varchar(6), diff --git a/pgsql/tables/llx_categorie.sql b/pgsql/tables/llx_categorie.sql index ee3645a7643..99011a28598 100644 --- a/pgsql/tables/llx_categorie.sql +++ b/pgsql/tables/llx_categorie.sql @@ -3,8 +3,9 @@ -- (c) 2005, Laurent Destailleur. -- ============================================================================ --- Copyright (C) 2005 Brice Davoleau --- Copyright (C) 2005 Matthieu Valleton +-- Copyright (C) 2005 Brice Davoleau +-- Copyright (C) 2005 Matthieu Valleton +-- Copyright (C) 2005-2006 Regis Houssin -- -- 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 @@ -28,6 +29,7 @@ create table llx_categorie ( rowid SERIAL PRIMARY KEY, - "label" VARCHAR(255), - "description" text + "label" VARCHAR(255), -- nom de la catégorie + "description" text, -- description de la catégorie + "visible" smallint DEFAULT 1 NOT NULL -- determine si les produits sont visible ou pas ); diff --git a/pgsql/tables/llx_comfourn_facfourn.sql b/pgsql/tables/llx_comfourn_facfourn.sql new file mode 100644 index 00000000000..e0ee1ff43df --- /dev/null +++ b/pgsql/tables/llx_comfourn_facfourn.sql @@ -0,0 +1,36 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- =================================================================== +-- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2005-2006 Regis Houssin +-- +-- 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$ +-- =================================================================== + + +create table llx_comfourn_facfourn +( + rowid SERIAL PRIMARY KEY, + "fk_commande" integer NOT NULL, + "fk_facture" integer NOT NULL +); + +CREATE INDEX idx_llx_comfourn_facfourn_fk_commande ON llx_comfourn_facfourn (fk_commande); +CREATE INDEX idx_llx_comfourn_facfourn_fk_facture ON llx_comfourn_facfourn (fk_facture); diff --git a/pgsql/tables/llx_commande.key.sql b/pgsql/tables/llx_commande.key.sql new file mode 100644 index 00000000000..970a7a3d207 --- /dev/null +++ b/pgsql/tables/llx_commande.key.sql @@ -0,0 +1,32 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2006 Laurent Destailleur +-- +-- 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); diff --git a/pgsql/tables/llx_commande.sql b/pgsql/tables/llx_commande.sql index 8f653377ae4..9e93050c6a0 100644 --- a/pgsql/tables/llx_commande.sql +++ b/pgsql/tables/llx_commande.sql @@ -24,33 +24,41 @@ -- -- =================================================================== + + create table llx_commande ( rowid SERIAL PRIMARY KEY, - "tms" timestamp, - "fk_soc" integer, - "fk_soc_contact" integer, - "fk_projet" integer DEFAULT 0, -- projet auquel est rattache la commande - "ref" varchar(30) NOT NULL, -- order number - "ref_client" varchar(30), -- customer order number - "date_creation" timestamp, -- date de creation - "date_valid" timestamp, -- date de validation - "date_cloture" timestamp, -- date de cloture - "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 - "source" smallint NOT NULL, - "fk_statut" smallint default 0, - "amount_ht" real default 0, - "remise_percent" real default 0, - "remise" real default 0, - "tva" real default 0, - "total_ht" real default 0, - "total_ttc" real default 0, - "note" text, - "model_pdf" varchar(50), - "facture" smallint default 0, + "tms" timestamp, + "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 + "ref_client" varchar(30), -- customer order number + "date_creation" timestamp, -- date de creation + "date_valid" timestamp, -- date de validation + "date_cloture" timestamp, -- date de cloture + "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, -- auteur cloture + "source" smallint NOT NULL, + "fk_statut" smallint default 0, + "amount_ht" real default 0, + "remise_percent" real default 0, + "remise_absolue" real default 0, + "remise" real default 0, + "tva" real default 0, + "total_ht" real default 0, + "total_ttc" real default 0, + "note" text, + "note_public" text, + "model_pdf" varchar(50), + "facture" smallint default 0, + "fk_cond_reglement" integer, -- condition de réglement + "fk_mode_reglement" integer, -- mode de réglement + "date_livraison" date default NULL, + "fk_adresse_livraison" integer, -- adresse de livraison UNIQUE(ref) ); diff --git a/pgsql/tables/llx_commande_fournisseur.key.sql b/pgsql/tables/llx_commande_fournisseur.key.sql new file mode 100644 index 00000000000..6065e0e134f --- /dev/null +++ b/pgsql/tables/llx_commande_fournisseur.key.sql @@ -0,0 +1,32 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2006 Laurent Destailleur +-- +-- 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); diff --git a/pgsql/tables/llx_commande_fournisseur.sql b/pgsql/tables/llx_commande_fournisseur.sql index d026b00c134..c605d6ac45d 100644 --- a/pgsql/tables/llx_commande_fournisseur.sql +++ b/pgsql/tables/llx_commande_fournisseur.sql @@ -25,22 +25,23 @@ -- =================================================================== + + create table llx_commande_fournisseur ( rowid SERIAL 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" timestamp, -- date de creation "date_valid" timestamp, -- date de validation "date_cloture" timestamp, -- 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, @@ -50,7 +51,9 @@ 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(ref) ); diff --git a/pgsql/tables/llx_commandedet.sql b/pgsql/tables/llx_commandedet.sql index c1cc42a324d..c5644ef6c64 100644 --- a/pgsql/tables/llx_commandedet.sql +++ b/pgsql/tables/llx_commandedet.sql @@ -35,5 +35,6 @@ create table llx_commandedet "remise_percent" real DEFAULT 0, -- pourcentage de remise "remise" real DEFAULT 0, -- montant de la remise "subprice" real, -- prix avant remise - "price" real -- prix final + "price" real, -- prix final + "coef" real -- coefficient de marge ); diff --git a/pgsql/tables/llx_cond_reglement.sql b/pgsql/tables/llx_cond_reglement.sql index 3c9509c8b7d..71469d4da38 100644 --- a/pgsql/tables/llx_cond_reglement.sql +++ b/pgsql/tables/llx_cond_reglement.sql @@ -1,38 +1,38 @@ --- Generated from dolibarr_mysql2pgsql --- (c) 2004, PostgreSQL Inc. --- (c) 2005, Laurent Destailleur. - --- ============================================================================ --- Copyright (C) 2002-2003 Rodolphe Quiedeville --- --- 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$ --- --- ============================================================================ - -create table llx_cond_reglement -( - rowid integer PRIMARY KEY, - "code" varchar(16), - "sortorder" smallint, - "active" smallint DEFAULT 1, - "libelle" varchar(255), - "libelle_facture" text, - "fdm" smallint, -- reglement fin de mois - "nbjour" smallint, - "decalage" smallint -); +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2002-2003 Rodolphe Quiedeville +-- +-- 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$ +-- +-- ============================================================================ + +create table llx_cond_reglement +( + rowid integer PRIMARY KEY, + "code" varchar(16), + "sortorder" smallint, + "active" smallint DEFAULT 1, + "libelle" varchar(255), + "libelle_facture" text, + "fdm" smallint, -- reglement fin de mois + "nbjour" smallint, + "decalage" smallint +); diff --git a/pgsql/tables/llx_contrat.key.sql b/pgsql/tables/llx_contrat.key.sql index afe092c34dc..bcdac311a15 100644 --- a/pgsql/tables/llx_contrat.key.sql +++ b/pgsql/tables/llx_contrat.key.sql @@ -34,5 +34,5 @@ ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_soc (fk_soc); ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_user_author (fk_user_author); -ALTER TABLE llx_contrat ADD FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); -ALTER TABLE llx_contrat ADD FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); \ No newline at end of file +ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_societe FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); \ No newline at end of file diff --git a/pgsql/tables/llx_contrat.sql b/pgsql/tables/llx_contrat.sql index cc6b39630b4..fc1a830ba7d 100644 --- a/pgsql/tables/llx_contrat.sql +++ b/pgsql/tables/llx_contrat.sql @@ -42,6 +42,8 @@ create table llx_contrat "fk_commercial_suivi" integer NOT NULL, -- obsolete "fk_user_author" integer NOT NULL default 0, "fk_user_mise_en_service" integer, - "fk_user_cloture" integer + "fk_user_cloture" integer, + "note" text, + "note_public" text ); diff --git a/pgsql/tables/llx_document_model.sql b/pgsql/tables/llx_document_model.sql new file mode 100644 index 00000000000..785aea2b064 --- /dev/null +++ b/pgsql/tables/llx_document_model.sql @@ -0,0 +1,36 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- =================================================================== +-- Copyright (C) 2001-2003 Rodolphe Quiedeville +-- Copyright (C) 2006 Laurent Destailleur +-- +-- 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$ +-- +-- Liste des modeles de document disponibles +-- +-- =================================================================== + +create table llx_document_model +( + nom varchar(50) PRIMARY KEY, + "type" varchar(12) NOT NULL, + "libelle" varchar(255), + "description" text +); \ No newline at end of file diff --git a/pgsql/tables/llx_facture.key.sql b/pgsql/tables/llx_facture.key.sql index 365604c3015..d4d96f3be71 100644 --- a/pgsql/tables/llx_facture.key.sql +++ b/pgsql/tables/llx_facture.key.sql @@ -35,3 +35,5 @@ ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_soc FOREIGN KEY ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); + +ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber); diff --git a/pgsql/tables/llx_facture.sql b/pgsql/tables/llx_facture.sql index fa164839084..2f98926f037 100644 --- a/pgsql/tables/llx_facture.sql +++ b/pgsql/tables/llx_facture.sql @@ -4,6 +4,7 @@ -- =========================================================================== -- Copyright (C) 2001-2005 Rodolphe Quiedeville +-- Copyright (C) 2006 Laurent Destailleur -- -- 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 @@ -28,7 +29,6 @@ - create table llx_facture ( rowid SERIAL PRIMARY KEY, @@ -41,11 +41,12 @@ create table llx_facture "date_valid" date, -- date de validation "paye" smallint DEFAULT 0 NOT NULL, "amount" real DEFAULT 0 NOT NULL, - "remise_percent" real DEFAULT 0, -- remise globale en pourcent - "remise" real DEFAULT 0, - "tva" real DEFAULT 0, -- montant tva apres remise globale - "total" real DEFAULT 0, -- montant total ht apres remise globale - "total_ttc" real DEFAULT 0, -- montant total ttc apres remise globale + "remise_percent" real DEFAULT 0, -- remise relative + "remise_absolue" real DEFAULT 0, -- remise absolue + "remise" real DEFAULT 0, -- remise totale calculee + "tva" real DEFAULT 0, -- montant tva apres remise totale + "total" real DEFAULT 0, -- montant total ht apres remise totale + "total_ttc" real DEFAULT 0, -- montant total ttc apres remise totale "fk_statut" smallint DEFAULT 0 NOT NULL, "fk_user_author" integer, -- createur de la facture "fk_user_valid" integer, -- valideur de la facture @@ -54,8 +55,6 @@ create table llx_facture "fk_mode_reglement" integer, -- mode de reglement (Virement, Prélèvement) "date_lim_reglement" date, -- date limite de reglement "note" text, - "model" varchar(50), - UNIQUE(facnumber) + "note_public" text, + "model" varchar(50) ); - -CREATE INDEX idx_llx_facture_facnumber ON llx_facture (facnumber); diff --git a/pgsql/tables/llx_facture_fourn_det.key.sql b/pgsql/tables/llx_facture_fourn_det.key.sql new file mode 100644 index 00000000000..3772e5047dd --- /dev/null +++ b/pgsql/tables/llx_facture_fourn_det.key.sql @@ -0,0 +1,31 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- +-- 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_facture_fourn_det FROM llx_facture_fourn_det LEFT JOIN llx_facture_fourn ON llx_facture_fourn_det.fk_facture_fourn = llx_facture_fourn.rowid WHERE llx_facture_fourn.rowid IS NULL; + +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); diff --git a/pgsql/tables/llx_livre.sql b/pgsql/tables/llx_facture_rec.key.sql similarity index 57% rename from pgsql/tables/llx_livre.sql rename to pgsql/tables/llx_facture_rec.key.sql index 56239d2ed1e..d7ab5d0ec1a 100644 --- a/pgsql/tables/llx_livre.sql +++ b/pgsql/tables/llx_facture_rec.key.sql @@ -3,7 +3,8 @@ -- (c) 2005, Laurent Destailleur. -- ============================================================================ --- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2002-2004 Rodolphe Quiedeville +-- Copyright (C) 2004-2006 Laurent Destailleur -- -- 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 @@ -25,23 +26,11 @@ -- ============================================================================ -create table llx_livre -( - rowid SERIAL PRIMARY KEY, - "oscid" integer NOT NULL, - "tms" timestamp, - "status" smallint, - "date_ajout" timestamp, - "ref" varchar(12), - "title" varchar(64), - "annee" int2, - "description" text, - "prix" decimal(15,4), - "fk_editeur" integer, - "fk_user_author" integer, - "frais_de_port" smallint DEFAULT 1, - UNIQUE(ref) -); +ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_soc (fk_soc); +ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_user_author (fk_user_author); +ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_projet (fk_projet); -CREATE INDEX idx_llx_livre_ref ON llx_livre (ref); +ALTER TABLE llx_facture_rec ADD CONSTRAINT fk_facture_rec_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); +ALTER TABLE llx_facture_rec ADD CONSTRAINT fk_facture_rec_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); +ALTER TABLE llx_facture_rec ADD UNIQUE INDEX idx_facture_rec_uk_titre (titre); diff --git a/pgsql/tables/llx_facture_rec.sql b/pgsql/tables/llx_facture_rec.sql index 8beb4250566..3567fe68f64 100644 --- a/pgsql/tables/llx_facture_rec.sql +++ b/pgsql/tables/llx_facture_rec.sql @@ -4,6 +4,7 @@ -- =========================================================================== -- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2006 Laurent Destailleur -- -- 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 @@ -37,13 +38,17 @@ create table llx_facture_rec "amount" real DEFAULT 0 NOT NULL, "remise" real DEFAULT 0, "remise_percent" real DEFAULT 0, + "remise_absolue" real DEFAULT 0, "tva" real DEFAULT 0, "total" real DEFAULT 0, "total_ttc" real DEFAULT 0, "fk_user_author" integer, -- createur "fk_projet" integer, -- projet auquel est associé la facture "fk_cond_reglement" integer, -- condition de reglement + "fk_mode_reglement" integer, -- mode de reglement (Virement, Prélèvement) + "date_lim_reglement" date, -- date limite de reglement "note" text, + "note_public" text, "frequency" varchar(2) DEFAULT NULL, "last_gen" varchar(7) DEFAULT NULL ); diff --git a/pgsql/tables/llx_livre_to_auteur.sql b/pgsql/tables/llx_facture_stats.sql similarity index 78% rename from pgsql/tables/llx_livre_to_auteur.sql rename to pgsql/tables/llx_facture_stats.sql index 14064501faf..aeb72a7bad7 100644 --- a/pgsql/tables/llx_livre_to_auteur.sql +++ b/pgsql/tables/llx_facture_stats.sql @@ -2,8 +2,8 @@ -- (c) 2004, PostgreSQL Inc. -- (c) 2005, Laurent Destailleur. --- ============================================================================ --- Copyright (C) 2003 Rodolphe Quiedeville +-- =================================================================== +-- Copyright (C) 2006 Rodolphe Quiedeville -- -- 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 @@ -21,13 +21,13 @@ -- -- $Id$ -- $Source$ --- --- ============================================================================ +-- =================================================================== -create table llx_livre_to_auteur +create table llx_facture_stats ( - "fk_livre" integer NOT NULL, - "fk_auteur" integer NOT NULL, - UNIQUE(fk_livre, fk_auteur) + "date_full" timestamp, + "date_day" date, + "data" varchar(50), + "value" real ); diff --git a/pgsql/tables/llx_facturedet.sql b/pgsql/tables/llx_facturedet.sql index b501d668928..4ab58ecb383 100644 --- a/pgsql/tables/llx_facturedet.sql +++ b/pgsql/tables/llx_facturedet.sql @@ -38,6 +38,7 @@ create table llx_facturedet "price" real, -- prix final "date_start" timestamp, -- date debut si service "date_end" timestamp, -- date fin si service + "info_bits" integer DEFAULT 0, "fk_code_ventilation" integer DEFAULT 0 NOT NULL, "fk_export_compta" integer DEFAULT 0 NOT NULL, "rang" integer DEFAULT 0 diff --git a/pgsql/tables/llx_livraison.key.sql b/pgsql/tables/llx_livraison.key.sql new file mode 100644 index 00000000000..26db89b9e20 --- /dev/null +++ b/pgsql/tables/llx_livraison.key.sql @@ -0,0 +1,32 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2006 Laurent Destailleur +-- +-- 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: llx_livraison.key.sql,v 1.1 2006/05/05 15:28:06 hregis Exp $ +-- $Source: /cvsroot/dolibarr/dolibarr/mysql/tables/llx_livraison.key.sql,v $ +-- +-- ============================================================================ + + +-- Supprimme orphelins pour permettre montée de la clé +-- V4 DELETE llx_livraison FROM llx_livraison LEFT JOIN llx_societe ON llx_livraison.fk_soc = llx_societe.idp WHERE llx_societe.idp IS NULL; + +ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_soc (fk_soc); +ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); diff --git a/pgsql/tables/llx_livraison.sql b/pgsql/tables/llx_livraison.sql new file mode 100644 index 00000000000..47750d02fa5 --- /dev/null +++ b/pgsql/tables/llx_livraison.sql @@ -0,0 +1,52 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- =================================================================== +-- Copyright (C) 2003 Rodolphe Quiedeville +-- +-- 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$ +-- +-- =================================================================== + + +create table llx_livraison +( + rowid SERIAL PRIMARY KEY, + "tms" timestamp, + "fk_soc" integer NOT NULL, + "fk_soc_contact" integer, + "fk_commande" integer DEFAULT 0, -- commande auquel est rattache le bon de livraison + "fk_expedition" integer, -- expedition auquel est rattache le bon de livraison + "ref" varchar(30) NOT NULL, -- delivery number + "date_creation" timestamp, -- date de creation + "date_valid" timestamp, -- date de validation + "fk_user_author" integer, -- createur du bon de livraison + "fk_user_valid" integer, -- valideur du bon de livraison + "fk_statut" smallint default 0, + "total_ht" real default 0, + "total_ttc" real default 0, + "note" text, + "note_public" text, + "model_pdf" varchar(50), + "date_livraison" date default NULL, + "fk_adresse_livraison" integer, -- adresse de livraison + UNIQUE(ref) +); + +CREATE INDEX idx_llx_livraison_ref ON llx_livraison (ref); diff --git a/pgsql/tables/llx_accountingsystem_det.key.sql b/pgsql/tables/llx_livraisondet.sql similarity index 71% rename from pgsql/tables/llx_accountingsystem_det.key.sql rename to pgsql/tables/llx_livraisondet.sql index 23c188967fe..af88ced1aec 100644 --- a/pgsql/tables/llx_accountingsystem_det.key.sql +++ b/pgsql/tables/llx_livraisondet.sql @@ -2,9 +2,8 @@ -- (c) 2004, PostgreSQL Inc. -- (c) 2005, Laurent Destailleur. --- ============================================================================ +-- =================================================================== -- Copyright (C) 2003 Rodolphe Quiedeville --- Copyright (C) 2005 Laurent Destailleur -- -- 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 @@ -22,11 +21,15 @@ -- -- $Id$ -- $Source$ --- --- =========================================================================== +-- =================================================================== +create table llx_livraisondet +( + rowid SERIAL PRIMARY KEY, + "fk_livraison" integer, + "fk_commande_ligne" integer NOT NULL, + "qty" real -- quantité +); -ALTER TABLE llx_accountingsystem_det ADD INDEX idx_accountingsystem_det_fk_pcg_version (fk_pcg_version); - - -ALTER TABLE llx_accountingsystem_det ADD CONSTRAINT fk_accountingsystem_det_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accountingsystem (pcg_version); +CREATE INDEX idx_llx_livraisondet_fk_livraison ON llx_livraisondet (fk_livraison); +CREATE INDEX idx_llx_livraisondet_fk_commande_ligne ON llx_livraisondet (fk_commande_ligne); diff --git a/pgsql/tables/llx_paiementfourn.sql b/pgsql/tables/llx_paiementfourn.sql index 890f9518bda..18eee83150b 100644 --- a/pgsql/tables/llx_paiementfourn.sql +++ b/pgsql/tables/llx_paiementfourn.sql @@ -36,5 +36,6 @@ create table llx_paiementfourn "fk_paiement" integer NOT NULL, -- moyen de paiement "num_paiement" varchar(50), -- numéro de paiement (cheque) "note" text, - "fk_bank" integer NOT NULL + "fk_bank" integer NOT NULL, + "statut" int2 NOT NULL DEFAULT 0 ); diff --git a/pgsql/tables/llx_paiementfourn_facturefourn.key.sql b/pgsql/tables/llx_paiementfourn_facturefourn.key.sql new file mode 100644 index 00000000000..cf6fed72819 --- /dev/null +++ b/pgsql/tables/llx_paiementfourn_facturefourn.key.sql @@ -0,0 +1,29 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2005 Marc Barilley / Océbo +-- Copyright (C) 2005 Laurent Destailleur +-- +-- 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_paiementfourn_facturefourn ADD INDEX idx_paiementfourn_facturefourn_fk_facture(fk_facturefourn); +ALTER TABLE llx_paiementfourn_facturefourn ADD INDEX idx_paiementfourn_facturefourn_fk_paiement(fk_paiementfourn); diff --git a/pgsql/tables/llx_paiementfourn_facturefourn.sql b/pgsql/tables/llx_paiementfourn_facturefourn.sql index 1a7ddf8add7..76594090e57 100644 --- a/pgsql/tables/llx_paiementfourn_facturefourn.sql +++ b/pgsql/tables/llx_paiementfourn_facturefourn.sql @@ -1,36 +1,34 @@ --- Generated from dolibarr_mysql2pgsql --- (c) 2004, PostgreSQL Inc. --- (c) 2005, Laurent Destailleur. - --- ============================================================================ --- Copyright (C) 2003 Rodolphe Quiedeville --- Copyright (C) 2005 Marc Barilley / Océbo --- --- 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$ --- --- =========================================================================== - -create table llx_paiementfourn_facturefourn -( - rowid SERIAL PRIMARY KEY, - "fk_paiementfourn" int4 default NULL, - "fk_facturefourn" int4 default NULL, - "amount" real default '0', - UNIQUE(fk_facturefourn), - UNIQUE(fk_paiementfourn) -); +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2005 Marc Barilley / Océbo +-- Copyright (C) 2005 Laurent Destailleur +-- +-- 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$ +-- =========================================================================== + +create table llx_paiementfourn_facturefourn +( + rowid SERIAL PRIMARY KEY, + "fk_paiementfourn" INT(11) DEFAULT NULL, + "fk_facturefourn" INT(11) DEFAULT NULL, + "amount" real DEFAULT '0' +); \ No newline at end of file diff --git a/pgsql/tables/llx_product.sql b/pgsql/tables/llx_product.sql index 07799b1fea4..0a690eefea2 100644 --- a/pgsql/tables/llx_product.sql +++ b/pgsql/tables/llx_product.sql @@ -43,7 +43,8 @@ create table llx_product "duration" varchar(6), "stock_propale" integer DEFAULT 0, "stock_commande" integer DEFAULT 0, - "seuil_stock_alerte" integer DEFAULT 0 + "seuil_stock_alerte" integer DEFAULT 0, + "gencode" varchar(255) DEFAULT NULL ); diff --git a/pgsql/tables/llx_lieu_concert.sql b/pgsql/tables/llx_product_det.sql similarity index 75% rename from pgsql/tables/llx_lieu_concert.sql rename to pgsql/tables/llx_product_det.sql index 4e5494f734d..85096b67cbb 100644 --- a/pgsql/tables/llx_lieu_concert.sql +++ b/pgsql/tables/llx_product_det.sql @@ -3,7 +3,7 @@ -- (c) 2005, Laurent Destailleur. -- ============================================================================ --- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2002-2003 Rodolphe Quiedeville -- -- 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 @@ -24,13 +24,12 @@ -- -- ============================================================================ -create table llx_lieu_concert +create table llx_product_det ( rowid SERIAL PRIMARY KEY, - "tms" timestamp, - "nom" varchar(64) NOT NULL, - "description" text, - "ville" varchar(64) NOT NULL, - "fk_user_author" integer + "fk_product" integer DEFAULT 0 NOT NULL, + "lang" varchar(5) DEFAULT 0 NOT NULL, + "label" varchar(128), + "description" varchar(255), + "note" text ); - diff --git a/pgsql/tables/llx_projet_task_actors.sql b/pgsql/tables/llx_projet_task_actors.sql index 5fc779ca93e..6084613107a 100644 --- a/pgsql/tables/llx_projet_task_actors.sql +++ b/pgsql/tables/llx_projet_task_actors.sql @@ -1,38 +1,38 @@ --- Generated from dolibarr_mysql2pgsql --- (c) 2004, PostgreSQL Inc. --- (c) 2005, Laurent Destailleur. - --- =========================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- 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$ --- --- =========================================================================== - - - -create table llx_projet_task_actors -( - "fk_projet_task" integer NOT NULL, - "fk_user" integer NOT NULL, - "role" varchar(5) CHECK (role IN ('admin','read','acto','info')) DEFAULT 'admin', - UNIQUE(fk_projet_task, fk_user) -); - -CREATE INDEX idx_llx_projet_task_actors_fk_projet_task_fk_user ON llx_projet_task_actors (fk_projet_task, fk_user); -CREATE INDEX idx_llx_projet_task_actors_role ON llx_projet_task_actors (role) +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- =========================================================================== +-- Copyright (C) 2005 Rodolphe Quiedeville +-- +-- 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$ +-- +-- =========================================================================== + + + +create table llx_projet_task_actors +( + "fk_projet_task" integer NOT NULL, + "fk_user" integer NOT NULL, + "role" varchar(5) CHECK (role IN ('admin','read','acto','info')) DEFAULT 'admin', + UNIQUE(fk_projet_task, fk_user) +); + +CREATE INDEX idx_llx_projet_task_actors_fk_projet_task_fk_user ON llx_projet_task_actors (fk_projet_task, fk_user); +CREATE INDEX idx_llx_projet_task_actors_role ON llx_projet_task_actors (role); diff --git a/pgsql/tables/llx_projet_task_time.sql b/pgsql/tables/llx_projet_task_time.sql index 57f034412d3..bcb253917a1 100644 --- a/pgsql/tables/llx_projet_task_time.sql +++ b/pgsql/tables/llx_projet_task_time.sql @@ -1,40 +1,40 @@ --- Generated from dolibarr_mysql2pgsql --- (c) 2004, PostgreSQL Inc. --- (c) 2005, Laurent Destailleur. - --- =========================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- 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$ --- --- =========================================================================== - - - -create table llx_projet_task_time -( - rowid SERIAL PRIMARY KEY, - "fk_task" integer NOT NULL, - "task_date" date, - "task_duration" real, - "fk_user" integer, - "note" text -); - -CREATE INDEX idx_llx_projet_task_time_fk_task ON llx_projet_task_time (fk_task); -CREATE INDEX idx_llx_projet_task_time_fk_user ON llx_projet_task_time (fk_user); +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- =========================================================================== +-- Copyright (C) 2005 Rodolphe Quiedeville +-- +-- 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$ +-- +-- =========================================================================== + + + +create table llx_projet_task_time +( + rowid SERIAL PRIMARY KEY, + "fk_task" integer NOT NULL, + "task_date" date, + "task_duration" real, + "fk_user" integer, + "note" text +); + +CREATE INDEX idx_llx_projet_task_time_fk_task ON llx_projet_task_time (fk_task); +CREATE INDEX idx_llx_projet_task_time_fk_user ON llx_projet_task_time (fk_user); diff --git a/pgsql/tables/llx_propal.sql b/pgsql/tables/llx_propal.sql index e37d96e0b64..3cd81cdfdae 100644 --- a/pgsql/tables/llx_propal.sql +++ b/pgsql/tables/llx_propal.sql @@ -25,8 +25,6 @@ -- =================================================================== - - create table llx_propal ( rowid SERIAL PRIMARY KEY, @@ -44,15 +42,21 @@ create table llx_propal "fk_user_cloture" integer, -- cloture de la propale signee ou non signee "fk_statut" smallint DEFAULT 0 NOT NULL, "price" real DEFAULT 0, - "remise_percent" real DEFAULT 0, -- remise globale en pourcent - "remise" real DEFAULT 0, + "remise_percent" real DEFAULT 0, -- remise globale relative en pourcent + "remise_absolue" real DEFAULT 0, -- remise globale absolue + "remise" real DEFAULT 0, -- remise calculee "tva" real DEFAULT 0, -- montant tva apres remise globale "total_ht" real DEFAULT 0, -- montant total ht apres remise globale "total" real DEFAULT 0, -- montant total ttc apres remise globale "fk_cond_reglement" integer, -- condition de reglement (30 jours, fin de mois ...) "fk_mode_reglement" integer, -- mode de reglement (Virement, Prélèvement) + "note" text, + "note_public" text, "model_pdf" varchar(50), + "date_livraison" date default NULL, + "fk_adresse_livraison" integer, -- adresse de livraison + UNIQUE(ref) ); diff --git a/pgsql/tables/llx_societe.sql b/pgsql/tables/llx_societe.sql index 0136f9cc4c0..39c07cd8116 100644 --- a/pgsql/tables/llx_societe.sql +++ b/pgsql/tables/llx_societe.sql @@ -1,72 +1,72 @@ --- Generated from dolibarr_mysql2pgsql --- (c) 2004, PostgreSQL Inc. --- (c) 2005, Laurent Destailleur. - --- ======================================================================== --- Copyright (C) 2000-2004 Rodolphe Quiedeville --- --- 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$ --- --- ======================================================================== - -create table llx_societe -( - idp SERIAL PRIMARY KEY, - "id" varchar(32), -- private id - "active" smallint DEFAULT 0, -- - "parent" integer DEFAULT 0, -- - "tms" timestamp, - "datec" timestamp, -- creation date - "datea" timestamp, -- activation date - "nom" varchar(60), -- company name - "code_client" varchar(15), -- code client - "code_fournisseur" varchar(15), -- code founisseur - "code_compta" varchar(15), -- code compta client - "code_compta_fournisseur" varchar(15), -- code compta founisseur - "address" varchar(255), -- company adresse - "cp" varchar(10), -- zipcode - "ville" varchar(50), -- town - "fk_departement" integer DEFAULT 0, -- - "fk_pays" integer DEFAULT 0, -- - "tel" varchar(20), -- phone number - "fax" varchar(20), -- fax number - "url" varchar(255), -- - "fk_secteur" integer DEFAULT 0, -- - "fk_effectif" integer DEFAULT 0, -- - "fk_typent" integer DEFAULT 0, -- - "fk_forme_juridique" integer DEFAULT 0, -- forme juridique INSEE - "siren" varchar(9), -- siren ou RCS - "siret" varchar(14), -- numero de siret - "ape" varchar(4), -- code ape - "tva_intra" varchar(20), -- tva intracommunautaire - "capital" real, -- capital de la société - "description" text, -- - "fk_stcomm" smallint DEFAULT 0, -- commercial statut - "note" text, -- - "services" integer DEFAULT 0, -- - "prefix_comm" varchar(5), -- prefix commercial - "client" integer DEFAULT 0, -- client oui/non - "fournisseur" smallint DEFAULT 0, -- fournisseur oui/non - "rubrique" varchar(255), -- champ rubrique libre - "fk_user_creat" integer, -- utilisateur qui a créé l'info - "fk_user_modif" integer, -- utilisateur qui a modifié l'info - "remise_client" real DEFAULT 0, -- remise systématique pour le client - "mode_reglement" integer DEFAULT 0 , -- mode de réglement - "cond_reglement" integer DEFAULT 1 NOT NULL -- condition de réglement -); - +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ======================================================================== +-- Copyright (C) 2000-2004 Rodolphe Quiedeville +-- +-- 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$ +-- +-- ======================================================================== + +create table llx_societe +( + idp SERIAL PRIMARY KEY, + "id" varchar(32), -- private id + "active" smallint DEFAULT 0, -- + "parent" integer DEFAULT 0, -- + "tms" timestamp, + "datec" timestamp, -- creation date + "datea" timestamp, -- activation date + "nom" varchar(60), -- company name + "code_client" varchar(15), -- code client + "code_fournisseur" varchar(15), -- code founisseur + "code_compta" varchar(15), -- code compta client + "code_compta_fournisseur" varchar(15), -- code compta founisseur + "address" varchar(255), -- company adresse + "cp" varchar(10), -- zipcode + "ville" varchar(50), -- town + "fk_departement" integer DEFAULT 0, -- + "fk_pays" integer DEFAULT 0, -- + "tel" varchar(20), -- phone number + "fax" varchar(20), -- fax number + "url" varchar(255), -- + "fk_secteur" integer DEFAULT 0, -- + "fk_effectif" integer DEFAULT 0, -- + "fk_typent" integer DEFAULT 0, -- + "fk_forme_juridique" integer DEFAULT 0, -- forme juridique INSEE + "siren" varchar(9), -- siren ou RCS + "siret" varchar(14), -- numero de siret + "ape" varchar(4), -- code ape + "tva_intra" varchar(20), -- tva intracommunautaire + "capital" real, -- capital de la société + "description" text, -- + "fk_stcomm" smallint DEFAULT 0, -- commercial statut + "note" text, -- + "services" integer DEFAULT 0, -- + "prefix_comm" varchar(5), -- prefix commercial + "client" integer DEFAULT 0, -- client oui/non + "fournisseur" smallint DEFAULT 0, -- fournisseur oui/non + "rubrique" varchar(255), -- champ rubrique libre + "fk_user_creat" integer, -- utilisateur qui a créé l'info + "fk_user_modif" integer, -- utilisateur qui a modifié l'info + "remise_client" real DEFAULT 0, -- remise systématique pour le client + "mode_reglement" integer DEFAULT 0, -- mode de réglement + "cond_reglement" integer DEFAULT 1 NOT NULL, -- condition de réglement + "tva_assuj" smallint DEFAULT 1 -- assujéti ou non à la TVA +); diff --git a/pgsql/tables/llx_societe_adresse_livraison.sql b/pgsql/tables/llx_societe_adresse_livraison.sql new file mode 100644 index 00000000000..d1e9f520ca2 --- /dev/null +++ b/pgsql/tables/llx_societe_adresse_livraison.sql @@ -0,0 +1,44 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ======================================================================== +-- Copyright (C) 2000-2004 Rodolphe Quiedeville +-- Copyright (C) 2005-2006 Houssin Régis +-- +-- 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$ +-- +-- ======================================================================== + +create table llx_societe_adresse_livraison +( + rowid SERIAL PRIMARY KEY, + "datec" timestamp, -- creation date + "tms" timestamp, -- modification date + "label" varchar(30), -- + "fk_societe" integer DEFAULT 0, -- + "nom" varchar(60), -- company name + "address" varchar(255), -- company adresse + "cp" varchar(10), -- zipcode + "ville" varchar(50), -- town + "fk_departement" integer DEFAULT 0, -- + "fk_pays" integer DEFAULT 0, -- + "note" text, -- + "fk_user_creat" integer, -- utilisateur qui a créé l'info + "fk_user_modif" integer -- utilisateur qui a modifié l'info +); \ No newline at end of file