From ab2cec7ae3a1fe962a0a27b02e2f605d7d701801 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Aug 2005 23:45:33 +0000 Subject: [PATCH] Mise a jours scripts pgsql --- pgsql/tables/llx_accountingsystem.sql | 36 ++++++++++++++++ pgsql/tables/llx_accountingsystem_det.key.sql | 32 ++++++++++++++ pgsql/tables/llx_accountingsystem_det.sql | 36 ++++++++++++++++ pgsql/tables/llx_actioncomm.key.sql | 31 +++++++++++++ pgsql/tables/llx_actioncomm.sql | 7 +-- pgsql/tables/llx_adherent.sql | 2 +- pgsql/tables/llx_bank_url.sql | 3 +- pgsql/tables/llx_bookmark.sql | 8 +++- pgsql/tables/llx_c_chargesociales.sql | 2 +- pgsql/tables/llx_c_departements.key.sql | 1 + pgsql/tables/llx_c_tva.sql | 37 ++++++++++++++++ .../tables/llx_categorie_association.key.sql | 10 +++-- pgsql/tables/llx_categorie_product.key.sql | 16 +++---- pgsql/tables/llx_contrat.key.sql | 8 ++-- pgsql/tables/llx_contrat.sql | 2 +- pgsql/tables/llx_contratdet.key.sql | 15 ++++--- pgsql/tables/llx_energie_compteur.sql | 36 ++++++++++++++++ pgsql/tables/llx_energie_compteur_groupe.sql | 31 +++++++++++++ pgsql/tables/llx_energie_compteur_releve.sql | 37 ++++++++++++++++ pgsql/tables/llx_energie_groupe.sql | 35 +++++++++++++++ pgsql/tables/llx_entrepot.sql | 2 +- pgsql/tables/llx_facture.key.sql | 2 + pgsql/tables/llx_facture.sql | 8 +++- pgsql/tables/llx_facture_fourn.key.sql | 36 ++++++++++++++++ pgsql/tables/llx_facture_fourn.sql | 5 +++ pgsql/tables/llx_facture_rec.sql | 5 ++- pgsql/tables/llx_facture_tva_sum.key.sql | 3 +- pgsql/tables/llx_facturedet.sql | 6 +-- pgsql/tables/llx_mailing_cibles.sql | 5 ++- pgsql/tables/llx_paiement_facture.key.sql | 4 +- pgsql/tables/llx_prelevement_facture.key.sql | 10 ++--- pgsql/tables/llx_prelevement_lignes.key.sql | 10 ++--- .../tables/llx_prelevement_notifications.sql | 39 +++++++++++++++++ pgsql/tables/llx_product.sql | 9 ++-- .../llx_product_fournisseur_price.key.sql | 7 +-- pgsql/tables/llx_projet_task.sql | 43 +++++++++++++++++++ pgsql/tables/llx_projet_task_actors.sql | 38 ++++++++++++++++ pgsql/tables/llx_projet_task_time.sql | 40 +++++++++++++++++ pgsql/tables/llx_propal.key.sql | 4 +- pgsql/tables/llx_societe.key.sql | 29 +++++++++++++ pgsql/tables/llx_societe.sql | 10 ++--- .../tables/llx_societe_remise_except.key.sql | 7 +-- pgsql/tables/llx_socpeople.sql | 1 + pgsql/tables/llx_user.sql | 34 ++++++++------- pgsql/tables/llx_user_param.sql | 8 ++-- pgsql/tables/llx_user_rights.key.sql | 8 ++-- pgsql/tables/llx_usergroup_rights.key.sql | 4 +- 47 files changed, 668 insertions(+), 94 deletions(-) create mode 100644 pgsql/tables/llx_accountingsystem.sql create mode 100644 pgsql/tables/llx_accountingsystem_det.key.sql create mode 100644 pgsql/tables/llx_accountingsystem_det.sql create mode 100644 pgsql/tables/llx_actioncomm.key.sql create mode 100644 pgsql/tables/llx_c_tva.sql create mode 100644 pgsql/tables/llx_energie_compteur.sql create mode 100644 pgsql/tables/llx_energie_compteur_groupe.sql create mode 100644 pgsql/tables/llx_energie_compteur_releve.sql create mode 100644 pgsql/tables/llx_energie_groupe.sql create mode 100644 pgsql/tables/llx_facture_fourn.key.sql create mode 100644 pgsql/tables/llx_prelevement_notifications.sql create mode 100644 pgsql/tables/llx_projet_task.sql create mode 100644 pgsql/tables/llx_projet_task_actors.sql create mode 100644 pgsql/tables/llx_projet_task_time.sql create mode 100644 pgsql/tables/llx_societe.key.sql diff --git a/pgsql/tables/llx_accountingsystem.sql b/pgsql/tables/llx_accountingsystem.sql new file mode 100644 index 00000000000..14be5c83571 --- /dev/null +++ b/pgsql/tables/llx_accountingsystem.sql @@ -0,0 +1,36 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2004 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_accountingsystem +( + pcg_version varchar(12) PRIMARY KEY, + "fk_pays" integer NOT NULL, + "label" varchar(128) NOT NULL, + "datec" varchar(12) NOT NULL, + "fk_author" varchar(20), + "tms" timestamp, + "active" smallint DEFAULT 0 +); diff --git a/pgsql/tables/llx_accountingsystem_det.key.sql b/pgsql/tables/llx_accountingsystem_det.key.sql new file mode 100644 index 00000000000..4daa934cf05 --- /dev/null +++ b/pgsql/tables/llx_accountingsystem_det.key.sql @@ -0,0 +1,32 @@ +-- Generated from dolibarr_mysql2pgsql +-- (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 +-- 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_accountingsystem_det ADD INDEX idx_accountingsystem_det_fk_pcg_version (fk_pcg_version); + + +ALTER TABLE llx_accountingsystem_det ADD FOREIGN KEY (fk_pcg_version) REFERENCES llx_accountingsystem (pcg_version); diff --git a/pgsql/tables/llx_accountingsystem_det.sql b/pgsql/tables/llx_accountingsystem_det.sql new file mode 100644 index 00000000000..8a5f9c94c2c --- /dev/null +++ b/pgsql/tables/llx_accountingsystem_det.sql @@ -0,0 +1,36 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2004 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_accountingsystem_det +( + rowid SERIAL PRIMARY KEY, + "fk_pcg_version" varchar(12) NOT NULL, + "pcg_type" varchar(20) NOT NULL, + "pcg_subtype" varchar(20) NOT NULL, + "label" varchar(128) NOT NULL, + "account_number" varchar(20) NOT NULL, + "account_parent" varchar(20) +); diff --git a/pgsql/tables/llx_actioncomm.key.sql b/pgsql/tables/llx_actioncomm.key.sql new file mode 100644 index 00000000000..f1071fbcaa8 --- /dev/null +++ b/pgsql/tables/llx_actioncomm.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$ +-- +-- =========================================================================== + + +ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datea (datea); +ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_soc (fk_soc); +ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_contact (fk_contact); +ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_facture (fk_facture); diff --git a/pgsql/tables/llx_actioncomm.sql b/pgsql/tables/llx_actioncomm.sql index ea20cc38ac1..39dfa360b8f 100644 --- a/pgsql/tables/llx_actioncomm.sql +++ b/pgsql/tables/llx_actioncomm.sql @@ -4,6 +4,7 @@ -- ======================================================================== -- Copyright (C) 2001-2003 Rodolphe Quiedeville +-- Copyright (C) 2005 Laurent Destailleur -- -- $Id$ -- $Source$ @@ -29,12 +30,12 @@ create table llx_actioncomm ( id SERIAL PRIMARY KEY, - "datea" timestamp, -- action date + "datea" timestamp, -- action date "fk_action" integer, - "label" varchar(50), -- libelle de l'action + "label" varchar(50) NOT NULL, -- libelle de l'action "fk_soc" integer, "fk_contact" integer default 0, - "fk_user_action" integer, -- id de la personne qui doit effectuer l'action + "fk_user_action" integer, -- id de la personne qui doit effectuer l'action "fk_user_author" integer, "priority" smallint, "percent" smallint NOT NULL default 0, diff --git a/pgsql/tables/llx_adherent.sql b/pgsql/tables/llx_adherent.sql index 670ea549381..ef404764540 100644 --- a/pgsql/tables/llx_adherent.sql +++ b/pgsql/tables/llx_adherent.sql @@ -54,7 +54,7 @@ create table llx_adherent "fk_user_author" integer NOT NULL, "fk_user_mod" integer NOT NULL, "fk_user_valid" integer NOT NULL, - "datefin" timestamp, -- date de fin de validité de la cotisation + "datefin" timestamp, -- date de fin de validité de la cotisation "note" text, UNIQUE(login) diff --git a/pgsql/tables/llx_bank_url.sql b/pgsql/tables/llx_bank_url.sql index a26c589e88c..dfe785c4463 100644 --- a/pgsql/tables/llx_bank_url.sql +++ b/pgsql/tables/llx_bank_url.sql @@ -30,5 +30,6 @@ create table llx_bank_url "fk_bank" integer, "url_id" integer, "url" varchar(255), - "label" varchar(255) + "label" varchar(255), + "type" varchar(8) CHECK (type IN ('company','payment','member','donation','charge')) ); diff --git a/pgsql/tables/llx_bookmark.sql b/pgsql/tables/llx_bookmark.sql index 0e929897d85..4cd397e6d5c 100644 --- a/pgsql/tables/llx_bookmark.sql +++ b/pgsql/tables/llx_bookmark.sql @@ -26,6 +26,10 @@ create table llx_bookmark ( rowid SERIAL PRIMARY KEY, "fk_soc" integer, - "fk_user" integer, - "dateb" timestamp + "fk_user" integer NOT NULL, + "dateb" timestamp, + "url" varchar(128) NOT NULL, + "target" varchar(16), + "title" varchar(64), + "favicon" varchar(24) ); diff --git a/pgsql/tables/llx_c_chargesociales.sql b/pgsql/tables/llx_c_chargesociales.sql index efce6e17f3a..d0b29f8d615 100644 --- a/pgsql/tables/llx_c_chargesociales.sql +++ b/pgsql/tables/llx_c_chargesociales.sql @@ -27,7 +27,7 @@ create table llx_c_chargesociales ( - id integer PRIMARY KEY, + id SERIAL PRIMARY KEY, "libelle" varchar(80), "deductible" smallint DEFAULT 0 NOT NULL, "active" smallint DEFAULT 1 NOT NULL diff --git a/pgsql/tables/llx_c_departements.key.sql b/pgsql/tables/llx_c_departements.key.sql index ad0222d41a1..ff19bcefe7d 100644 --- a/pgsql/tables/llx_c_departements.key.sql +++ b/pgsql/tables/llx_c_departements.key.sql @@ -27,4 +27,5 @@ ALTER TABLE llx_c_departements ADD UNIQUE uk_departements (code_departement,fk_region); + ALTER TABLE llx_c_departements ADD INDEX idx_departements_fk_region (fk_region); diff --git a/pgsql/tables/llx_c_tva.sql b/pgsql/tables/llx_c_tva.sql new file mode 100644 index 00000000000..836e4724ace --- /dev/null +++ b/pgsql/tables/llx_c_tva.sql @@ -0,0 +1,37 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ======================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- +-- $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. +-- +-- ======================================================================== + + +create table llx_c_tva +( + rowid SERIAL PRIMARY KEY, + "fk_pays" integer NOT NULL, + "taux" real NOT NULL, + "recuperableonly" integer DEFAULT 0, + "note" varchar(128), + "active" smallint DEFAULT 1 NOT NULL +); + diff --git a/pgsql/tables/llx_categorie_association.key.sql b/pgsql/tables/llx_categorie_association.key.sql index af2922e38d5..d615330a540 100644 --- a/pgsql/tables/llx_categorie_association.key.sql +++ b/pgsql/tables/llx_categorie_association.key.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 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,8 +23,9 @@ -- -- ============================================================================ -ALTER TABLE llx_categorie_association ADD INDEX (fk_categorie_mere); -ALTER TABLE llx_categorie_association ADD INDEX (fk_categorie_fille); + +ALTER TABLE llx_categorie_association ADD INDEX idx_categorie_association_fk_categorie_mere (fk_categorie_mere); +ALTER TABLE llx_categorie_association ADD INDEX idx_categorie_association_fk_categorie_fille (fk_categorie_fille); ALTER TABLE llx_categorie_association ADD FOREIGN KEY (fk_categorie_mere) REFERENCES llx_categorie (rowid); ALTER TABLE llx_categorie_association ADD FOREIGN KEY (fk_categorie_fille) REFERENCES llx_categorie (rowid); diff --git a/pgsql/tables/llx_categorie_product.key.sql b/pgsql/tables/llx_categorie_product.key.sql index afb19e5a855..fa83f2d6096 100644 --- a/pgsql/tables/llx_categorie_product.key.sql +++ b/pgsql/tables/llx_categorie_product.key.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 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,10 +23,9 @@ -- -- ============================================================================ -ALTER TABLE llx_categorie_product ADD INDEX (fk_categorie); -ALTER TABLE llx_categorie_product ADD INDEX (fk_product); -ALTER TABLE llx_categorie_product ADD FOREIGN KEY (fk_categorie) - REFERENCES llx_categorie (rowid); -ALTER TABLE llx_categorie_product ADD FOREIGN KEY (fk_product) - REFERENCES llx_product (rowid); +ALTER TABLE llx_categorie_product ADD INDEX idx_categorie_product_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_product ADD INDEX idx_categorie_product_fk_product (fk_product); + +ALTER TABLE llx_categorie_product ADD FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_product ADD FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); diff --git a/pgsql/tables/llx_contrat.key.sql b/pgsql/tables/llx_contrat.key.sql index 21753a12689..23f13e23005 100644 --- a/pgsql/tables/llx_contrat.key.sql +++ b/pgsql/tables/llx_contrat.key.sql @@ -4,7 +4,7 @@ -- ============================================================================ -- Copyright (C) 2002-2004 Rodolphe Quiedeville --- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2004-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 @@ -25,11 +25,13 @@ -- -- ============================================================================ + -- Supprimme orhpelins pour permettre montée de la clé -DELETE llx_contrat FROM llx_contrat LEFT JOIN llx_societe ON llx_contrat.fk_soc = llx_societe.idp WHERE llx_societe.idp IS NULL; +-- V4 DELETE llx_contrat FROM llx_contrat LEFT JOIN llx_societe ON llx_contrat.fk_soc = llx_societe.idp WHERE llx_societe.idp IS NULL; +-- V4 DELETE llx_contrat FROM llx_contrat LEFT JOIN llx_user ON llx_contrat.fk_user_author = llx_user.rowid WHERE llx_user.rowid IS NULL; 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); +ALTER TABLE llx_contrat ADD 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 fa06bd68343..bef37859eb2 100644 --- a/pgsql/tables/llx_contrat.sql +++ b/pgsql/tables/llx_contrat.sql @@ -26,7 +26,6 @@ -- ============================================================================ - create table llx_contrat ( rowid SERIAL PRIMARY KEY, @@ -38,6 +37,7 @@ create table llx_contrat "fin_validite" timestamp, "date_cloture" timestamp, "fk_soc" integer NOT NULL, + "fk_projet" integer, "fk_commercial_signature" integer NOT NULL, "fk_commercial_suivi" integer NOT NULL, "fk_user_author" integer NOT NULL default 0, diff --git a/pgsql/tables/llx_contratdet.key.sql b/pgsql/tables/llx_contratdet.key.sql index 4cbc38b5fd4..942d19899f0 100644 --- a/pgsql/tables/llx_contratdet.key.sql +++ b/pgsql/tables/llx_contratdet.key.sql @@ -4,6 +4,7 @@ -- ============================================================================ -- Copyright (C) 2004 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 @@ -23,11 +24,13 @@ -- $Source$ -- -- ============================================================================ --- --- -ALTER TABLE llx_contratdet ADD INDEX (fk_contrat); -ALTER TABLE llx_contratdet ADD INDEX (fk_product); --- --- + + +ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_fk_contrat (fk_contrat); +ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_fk_product (fk_product); +ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_date_ouverture_prevue (date_ouverture_prevue); +ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_date_ouverture (date_ouverture); +ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_date_fin_validite (date_fin_validite); + ALTER TABLE llx_contratdet ADD FOREIGN KEY (fk_contrat) REFERENCES llx_contrat (rowid); ALTER TABLE llx_contratdet ADD FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); diff --git a/pgsql/tables/llx_energie_compteur.sql b/pgsql/tables/llx_energie_compteur.sql new file mode 100644 index 00000000000..9140863cae9 --- /dev/null +++ b/pgsql/tables/llx_energie_compteur.sql @@ -0,0 +1,36 @@ +-- 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_energie_compteur +( + rowid SERIAL PRIMARY KEY, + "libelle" varchar(50), + "fk_energie" integer NOT NULL, + "datec" timestamp, + "fk_user_author" integer NOT NULL, + "note" text +); diff --git a/pgsql/tables/llx_energie_compteur_groupe.sql b/pgsql/tables/llx_energie_compteur_groupe.sql new file mode 100644 index 00000000000..3028ecf8adb --- /dev/null +++ b/pgsql/tables/llx_energie_compteur_groupe.sql @@ -0,0 +1,31 @@ +-- 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_energie_compteur_groupe +( + "fk_energie_compteur" integer NOT NULL, + "fk_energie_groupe" integer NOT NULL +); diff --git a/pgsql/tables/llx_energie_compteur_releve.sql b/pgsql/tables/llx_energie_compteur_releve.sql new file mode 100644 index 00000000000..599c67164c9 --- /dev/null +++ b/pgsql/tables/llx_energie_compteur_releve.sql @@ -0,0 +1,37 @@ +-- 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_energie_compteur_releve +( + rowid SERIAL PRIMARY KEY, + "fk_compteur" integer NOT NULL, + "date_releve" timestamp, + "valeur" real, + "datec" timestamp, + "fk_user_author" integer NOT NULL, + "note" text +); diff --git a/pgsql/tables/llx_energie_groupe.sql b/pgsql/tables/llx_energie_groupe.sql new file mode 100644 index 00000000000..569c371cbec --- /dev/null +++ b/pgsql/tables/llx_energie_groupe.sql @@ -0,0 +1,35 @@ +-- 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_energie_groupe +( + rowid SERIAL PRIMARY KEY, + "libelle" varchar(100), + "datec" timestamp, + "fk_user_author" integer NOT NULL, + "note" text +); diff --git a/pgsql/tables/llx_entrepot.sql b/pgsql/tables/llx_entrepot.sql index d2f3a1c6b9b..b926ffbab07 100644 --- a/pgsql/tables/llx_entrepot.sql +++ b/pgsql/tables/llx_entrepot.sql @@ -30,7 +30,7 @@ create table llx_entrepot rowid SERIAL PRIMARY KEY, "datec" timestamp, "tms" timestamp, - "label" varchar(255) NOT NULL, + "label" varchar(255) UNIQUE NOT NULL, "description" text, "lieu" varchar(64), -- résumé lieu situation "address" varchar(255), diff --git a/pgsql/tables/llx_facture.key.sql b/pgsql/tables/llx_facture.key.sql index 3b89783ac45..9d423b45d28 100644 --- a/pgsql/tables/llx_facture.key.sql +++ b/pgsql/tables/llx_facture.key.sql @@ -29,7 +29,9 @@ ALTER TABLE llx_facture ADD INDEX idx_facture_fk_soc (fk_soc); ALTER TABLE llx_facture ADD INDEX idx_facture_fk_user_author (fk_user_author); ALTER TABLE llx_facture ADD INDEX idx_facture_fk_user_valid (fk_user_valid); +ALTER TABLE llx_facture ADD INDEX idx_facture_fk_projet (fk_projet); 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); ALTER TABLE llx_facture ADD FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); +ALTER TABLE llx_facture ADD FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); diff --git a/pgsql/tables/llx_facture.sql b/pgsql/tables/llx_facture.sql index 138d0e7f2b9..19da87c0c51 100644 --- a/pgsql/tables/llx_facture.sql +++ b/pgsql/tables/llx_facture.sql @@ -24,6 +24,11 @@ -- =========================================================================== + + + + + create table llx_facture ( rowid SERIAL PRIMARY KEY, @@ -42,7 +47,7 @@ create table llx_facture "fk_statut" smallint DEFAULT 0 NOT NULL, "fk_user_author" integer, -- createur de la facture "fk_user_valid" integer, -- valideur de la facture - "fk_projet" integer, -- projet auquel est associé la facture + "fk_projet" integer, -- projet auquel est associée la facture "fk_cond_reglement" integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) "fk_mode_reglement" integer, -- mode de reglement (Virement, Prélèvement) "date_lim_reglement" date, -- date limite de reglement @@ -51,4 +56,3 @@ create table llx_facture ); CREATE INDEX idx_llx_facture_facnumber ON llx_facture (facnumber); -CREATE INDEX fksoc ON llx_facture (fk_soc); diff --git a/pgsql/tables/llx_facture_fourn.key.sql b/pgsql/tables/llx_facture_fourn.key.sql new file mode 100644 index 00000000000..366d2390513 --- /dev/null +++ b/pgsql/tables/llx_facture_fourn.key.sql @@ -0,0 +1,36 @@ +-- 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$ +-- +-- ============================================================================ + + +ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_fk_soc (fk_soc); +ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_fk_user_author (fk_user_author); +ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_fk_user_valid (fk_user_valid); +ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_fk_projet (fk_projet); + +ALTER TABLE llx_facture_fourn ADD FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); +ALTER TABLE llx_facture_fourn ADD FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); +ALTER TABLE llx_facture_fourn ADD FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); +ALTER TABLE llx_facture_fourn ADD FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); diff --git a/pgsql/tables/llx_facture_fourn.sql b/pgsql/tables/llx_facture_fourn.sql index c72623000e3..71877e82393 100644 --- a/pgsql/tables/llx_facture_fourn.sql +++ b/pgsql/tables/llx_facture_fourn.sql @@ -28,6 +28,8 @@ + + create table llx_facture_fourn ( rowid SERIAL PRIMARY KEY, @@ -47,6 +49,9 @@ create table llx_facture_fourn "fk_statut" smallint DEFAULT 0 NOT NULL, "fk_user_author" integer, -- createur de la facture "fk_user_valid" integer, -- valideur de la facture + "fk_projet" integer, -- projet auquel est associée la facture + "fk_cond_reglement" integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) + "date_lim_reglement" date, -- date limite de reglement "note" text, UNIQUE(facnumber, fk_soc) ); diff --git a/pgsql/tables/llx_facture_rec.sql b/pgsql/tables/llx_facture_rec.sql index 7a2136ce6b9..8beb4250566 100644 --- a/pgsql/tables/llx_facture_rec.sql +++ b/pgsql/tables/llx_facture_rec.sql @@ -27,6 +27,7 @@ + create table llx_facture_rec ( rowid SERIAL PRIMARY KEY, @@ -42,7 +43,9 @@ create table llx_facture_rec "fk_user_author" integer, -- createur "fk_projet" integer, -- projet auquel est associé la facture "fk_cond_reglement" integer, -- condition de reglement - "note" text + "note" text, + "frequency" varchar(2) DEFAULT NULL, + "last_gen" varchar(7) DEFAULT NULL ); CREATE INDEX idx_facture_rec_fksoc ON llx_facture_rec (fk_soc); diff --git a/pgsql/tables/llx_facture_tva_sum.key.sql b/pgsql/tables/llx_facture_tva_sum.key.sql index 0bdc7f24e42..7fffb9a2954 100644 --- a/pgsql/tables/llx_facture_tva_sum.key.sql +++ b/pgsql/tables/llx_facture_tva_sum.key.sql @@ -25,7 +25,8 @@ -- 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; +-- V4 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 INDEX idx_facture_tva_sum_fk_facture (fk_facture); 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/pgsql/tables/llx_facturedet.sql b/pgsql/tables/llx_facturedet.sql index 5a8876da945..279955ff0fe 100644 --- a/pgsql/tables/llx_facturedet.sql +++ b/pgsql/tables/llx_facturedet.sql @@ -3,7 +3,7 @@ -- (c) 2005, Laurent Destailleur. -- =================================================================== --- Copyright (C) 2001-2003 Rodolphe Quiedeville +-- Copyright (C) 2001-2005 Rodolphe Quiedeville -- Copyright (C) 2004 Laurent Destailleur -- -- This program is free software; you can redistribute it and/or modify @@ -24,7 +24,6 @@ -- $Source$ -- =================================================================== - create table llx_facturedet ( rowid SERIAL PRIMARY KEY, @@ -40,5 +39,6 @@ create table llx_facturedet "date_start" timestamp, -- date debut si service "date_end" timestamp, -- date fin si service "fk_code_ventilation" integer DEFAULT 0 NOT NULL, - "fk_export_compta" integer DEFAULT 0 NOT NULL + "fk_export_compta" integer DEFAULT 0 NOT NULL, + "rang" integer DEFAULT 0 ); diff --git a/pgsql/tables/llx_mailing_cibles.sql b/pgsql/tables/llx_mailing_cibles.sql index 605722d9985..a19c62dfb21 100644 --- a/pgsql/tables/llx_mailing_cibles.sql +++ b/pgsql/tables/llx_mailing_cibles.sql @@ -26,7 +26,6 @@ -- - create table llx_mailing_cibles ( rowid SERIAL PRIMARY KEY, @@ -34,6 +33,8 @@ create table llx_mailing_cibles "fk_contact" integer NOT NULL, "nom" varchar(160), "prenom" varchar(160), - "email" varchar(160) NOT NULL + "email" varchar(160) NOT NULL, + "statut" smallint NOT NULL DEFAULT 0, + "date_envoi" timestamp ); diff --git a/pgsql/tables/llx_paiement_facture.key.sql b/pgsql/tables/llx_paiement_facture.key.sql index 00defbeea91..01f4e31caff 100644 --- a/pgsql/tables/llx_paiement_facture.key.sql +++ b/pgsql/tables/llx_paiement_facture.key.sql @@ -25,8 +25,8 @@ -- =========================================================================== -- 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; +-- V4 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; +-- V4 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 INDEX idx_paiement_facture_fk_facture (fk_facture); ALTER TABLE llx_paiement_facture ADD CONSTRAINT paiement_facture_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid); diff --git a/pgsql/tables/llx_prelevement_facture.key.sql b/pgsql/tables/llx_prelevement_facture.key.sql index dcbc957ed81..2e1cdf1657b 100644 --- a/pgsql/tables/llx_prelevement_facture.key.sql +++ b/pgsql/tables/llx_prelevement_facture.key.sql @@ -4,6 +4,7 @@ -- ============================================================================ -- Copyright (C) 2005 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 @@ -24,10 +25,9 @@ -- -- ============================================================================ --- --- -ALTER TABLE llx_prelevement_facture ADD INDEX (fk_prelevement_lignes); --- --- + +ALTER TABLE llx_prelevement_facture ADD INDEX idx_prelevement_facture_fk_prelevement_lignes (fk_prelevement_lignes); + + ALTER TABLE llx_prelevement_facture ADD FOREIGN KEY (fk_prelevement_lignes) REFERENCES llx_prelevement_lignes (rowid); diff --git a/pgsql/tables/llx_prelevement_lignes.key.sql b/pgsql/tables/llx_prelevement_lignes.key.sql index f521f3b311d..4477cb9c0b9 100644 --- a/pgsql/tables/llx_prelevement_lignes.key.sql +++ b/pgsql/tables/llx_prelevement_lignes.key.sql @@ -4,6 +4,7 @@ -- ============================================================================ -- Copyright (C) 2005 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 @@ -24,10 +25,9 @@ -- -- ============================================================================ --- --- -ALTER TABLE llx_prelevement_lignes ADD INDEX (fk_prelevement_bons); --- --- + +ALTER TABLE llx_prelevement_lignes ADD INDEX idx_prelevement_lignes_fk_prelevement_bons (fk_prelevement_bons); + + ALTER TABLE llx_prelevement_lignes ADD FOREIGN KEY (fk_prelevement_bons) REFERENCES llx_prelevement_bons (rowid); diff --git a/pgsql/tables/llx_prelevement_notifications.sql b/pgsql/tables/llx_prelevement_notifications.sql new file mode 100644 index 00000000000..1f41e90a532 --- /dev/null +++ b/pgsql/tables/llx_prelevement_notifications.sql @@ -0,0 +1,39 @@ +-- 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$ +-- =================================================================== +-- +-- Utilisateur a notifier +-- +-- actions : +-- 'em' emission d'un bon +-- 'tr' tranmission d'un bon +-- 'cr' credit du bon par la banque + + +create table llx_prelevement_notifications +( + rowid SERIAL PRIMARY KEY, + "fk_user" integer NOT NULL, + "action" varchar(2) +); diff --git a/pgsql/tables/llx_product.sql b/pgsql/tables/llx_product.sql index 41efd86f7b4..bed08786a2a 100644 --- a/pgsql/tables/llx_product.sql +++ b/pgsql/tables/llx_product.sql @@ -30,11 +30,12 @@ create table llx_product rowid SERIAL PRIMARY KEY, "datec" timestamp, "tms" timestamp, - "ref" varchar(15) UNIQUE, - "label" varchar(255), - "description" text, + "ref" varchar(15) UNIQUE NOT NULL, + "label" varchar(128), + "description" varchar(255), + "note" text, "price" real, - "tva_tx" real DEFAULT 19.6, + "tva_tx" real, "fk_user_author" integer, "envente" smallint DEFAULT 1, "nbvente" integer DEFAULT 0, diff --git a/pgsql/tables/llx_product_fournisseur_price.key.sql b/pgsql/tables/llx_product_fournisseur_price.key.sql index 480096d527a..014b6cba01b 100644 --- a/pgsql/tables/llx_product_fournisseur_price.key.sql +++ b/pgsql/tables/llx_product_fournisseur_price.key.sql @@ -4,6 +4,7 @@ -- ============================================================================ -- 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 @@ -25,9 +26,9 @@ -- ============================================================================ -ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_fk_user (fk_user); -ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_fk_soc (fk_soc); -ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_fk_product (fk_product); +ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_product_fournisseur_price_fk_user (fk_user); +ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_product_fournisseur_price_fk_soc (fk_soc); +ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_product_fournisseur_price_fk_product (fk_product); ALTER TABLE llx_product_fournisseur_price ADD FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); ALTER TABLE llx_product_fournisseur_price ADD FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); diff --git a/pgsql/tables/llx_projet_task.sql b/pgsql/tables/llx_projet_task.sql new file mode 100644 index 00000000000..d161925171e --- /dev/null +++ b/pgsql/tables/llx_projet_task.sql @@ -0,0 +1,43 @@ +-- 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 +( + rowid SERIAL PRIMARY KEY, + "fk_projet" integer NOT NULL, + "fk_task_parent" integer NOT NULL, + "title" varchar(255), + "duration_effective" real NOT NULL, + "fk_user_creat" integer, -- createur + "statut" varchar(6) CHECK (statut IN ('open','closed')) DEFAULT 'open', + "note" text + +); + +CREATE INDEX idx_llx_projet_task_fk_projet ON llx_projet_task (fk_projet); +CREATE INDEX idx_llx_projet_task_statut ON llx_projet_task (statut); +CREATE INDEX idx_llx_projet_task_fk_user_creat ON llx_projet_task (fk_user_creat); diff --git a/pgsql/tables/llx_projet_task_actors.sql b/pgsql/tables/llx_projet_task_actors.sql new file mode 100644 index 00000000000..bc2d8f762f6 --- /dev/null +++ b/pgsql/tables/llx_projet_task_actors.sql @@ -0,0 +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" enum ('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 new file mode 100644 index 00000000000..dfebcfafb88 --- /dev/null +++ b/pgsql/tables/llx_projet_task_time.sql @@ -0,0 +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" smallint, + "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.key.sql b/pgsql/tables/llx_propal.key.sql index 799588bc074..e1af9b90e41 100644 --- a/pgsql/tables/llx_propal.key.sql +++ b/pgsql/tables/llx_propal.key.sql @@ -4,7 +4,7 @@ -- ============================================================================ -- Copyright (C) 2002-2004 Rodolphe Quiedeville --- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2004-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 @@ -27,5 +27,7 @@ ALTER TABLE llx_propal ADD INDEX idx_propal_fk_soc (fk_soc); + + ALTER TABLE llx_propal ADD FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); diff --git a/pgsql/tables/llx_societe.key.sql b/pgsql/tables/llx_societe.key.sql new file mode 100644 index 00000000000..fb465fbc25a --- /dev/null +++ b/pgsql/tables/llx_societe.key.sql @@ -0,0 +1,29 @@ +-- 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$ +-- +-- =================================================================== + + +ALTER TABLE llx_societe ADD UNIQUE uk_societe_prefix_comm(prefix_comm); +ALTER TABLE llx_societe ADD UNIQUE uk_societe_code_client(code_client); diff --git a/pgsql/tables/llx_societe.sql b/pgsql/tables/llx_societe.sql index 68caa9da578..1f9598c730d 100644 --- a/pgsql/tables/llx_societe.sql +++ b/pgsql/tables/llx_societe.sql @@ -24,7 +24,6 @@ -- -- ======================================================================== - create table llx_societe ( idp SERIAL PRIMARY KEY, @@ -36,7 +35,9 @@ create table llx_societe "datea" timestamp, -- activation date "nom" varchar(60), -- company name "code_client" varchar(15), -- code client - "code_compta" varchar(15), -- code compta + "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 @@ -64,9 +65,6 @@ create table llx_societe "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 - UNIQUE(prefix_comm) + "remise_client" real DEFAULT 0 -- remise systématique pour le client ); -CREATE INDEX idx_llx_societe_prefix_comm ON llx_societe (prefix_comm); - diff --git a/pgsql/tables/llx_societe_remise_except.key.sql b/pgsql/tables/llx_societe_remise_except.key.sql index 3925e33e3d6..2114908dad6 100644 --- a/pgsql/tables/llx_societe_remise_except.key.sql +++ b/pgsql/tables/llx_societe_remise_except.key.sql @@ -4,6 +4,7 @@ -- ============================================================================ -- Copyright (C) 2004 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 @@ -28,10 +29,10 @@ -- ============================================================================ +ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_user (fk_user); +ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_soc (fk_soc); +ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_facture (fk_facture); -ALTER TABLE llx_societe_remise_except ADD INDEX (fk_user); -ALTER TABLE llx_societe_remise_except ADD INDEX (fk_soc); -ALTER TABLE llx_societe_remise_except ADD INDEX (fk_facture); ALTER TABLE llx_societe_remise_except ADD FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); ALTER TABLE llx_societe_remise_except ADD FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); diff --git a/pgsql/tables/llx_socpeople.sql b/pgsql/tables/llx_socpeople.sql index 8a9b0474758..f2e9f6924cd 100644 --- a/pgsql/tables/llx_socpeople.sql +++ b/pgsql/tables/llx_socpeople.sql @@ -36,6 +36,7 @@ create table llx_socpeople "address" varchar(255), "cp" varchar(25), "ville" varchar(255), + "fk_pays" integer DEFAULT 0, "birthday" date, "poste" varchar(80), "phone" varchar(30), diff --git a/pgsql/tables/llx_user.sql b/pgsql/tables/llx_user.sql index c9cbb44aa91..67f927f4c05 100644 --- a/pgsql/tables/llx_user.sql +++ b/pgsql/tables/llx_user.sql @@ -24,25 +24,27 @@ -- -- =========================================================================== - create table llx_user ( rowid SERIAL PRIMARY KEY, - "datec" timestamp, - "tms" timestamp, - "login" varchar(8), - "pass" varchar(32), - "name" varchar(50), - "firstname" varchar(50), - "code" varchar(4), - "email" varchar(255), - "admin" smallint DEFAULT 0, - "webcal_login" varchar(25), - "module_comm" smallint DEFAULT 1, - "module_compta" smallint DEFAULT 1, - "fk_societe" integer DEFAULT 0, - "fk_socpeople" integer DEFAULT 0, - "note" text, + "datec" timestamp, + "tms" timestamp, + "login" varchar(8), + "pass" varchar(32), + "name" varchar(50), + "firstname" varchar(50), + "code" varchar(4), + "email" varchar(255), + "admin" smallint DEFAULT 0, + "webcal_login" varchar(25), + "module_comm" smallint DEFAULT 1, + "module_compta" smallint DEFAULT 1, + "fk_societe" integer DEFAULT 0, + "fk_socpeople" integer DEFAULT 0, + "note" text, + "datelastaccess" timestamp, + "egroupware_id" integer, + UNIQUE(login) ); diff --git a/pgsql/tables/llx_user_param.sql b/pgsql/tables/llx_user_param.sql index 73532a2d3c4..7ce1d721d73 100644 --- a/pgsql/tables/llx_user_param.sql +++ b/pgsql/tables/llx_user_param.sql @@ -28,10 +28,10 @@ create table llx_user_param ( - "fk_user" integer, - "page" varchar(255), - "param" varchar(64), - "value" varchar(255), + "fk_user" integer NOT NULL, + "page" varchar(255) NOT NULL, + "param" varchar(64) NOT NULL, + "value" varchar(255) NOT NULL, UNIQUE(fk_user,page,param) ); diff --git a/pgsql/tables/llx_user_rights.key.sql b/pgsql/tables/llx_user_rights.key.sql index d31783459ee..d5689536fae 100644 --- a/pgsql/tables/llx_user_rights.key.sql +++ b/pgsql/tables/llx_user_rights.key.sql @@ -4,6 +4,7 @@ -- ============================================================================ -- 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 @@ -24,10 +25,9 @@ -- -- =========================================================================== + -- Supprimme orhpelins pour permettre montée de la clé -delete llx_user_rights -from llx_user_rights -left join llx_user on llx_user_rights.fk_user = llx_user.rowid -where llx_user.rowid is null; +DELETE llx_user_rights FROM llx_user_rights LEFT JOIN llx_user ON llx_user_rights.fk_user = llx_user.rowid WHERE llx_user.rowid IS NULL; + ALTER TABLE llx_user_rights ADD FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); diff --git a/pgsql/tables/llx_usergroup_rights.key.sql b/pgsql/tables/llx_usergroup_rights.key.sql index c23e9d9b8f6..afded2e8f61 100644 --- a/pgsql/tables/llx_usergroup_rights.key.sql +++ b/pgsql/tables/llx_usergroup_rights.key.sql @@ -24,7 +24,9 @@ -- -- =========================================================================== + -- Supprime 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_usergroup = llx_usergroup.rowid WHERE llx_usergroup.rowid IS NULL; +-- V4 DELETE llx_usergroup_rights FROM llx_usergroup_rights LEFT JOIN llx_usergroup ON llx_usergroup_rights.fk_usergroup = llx_usergroup.rowid WHERE llx_usergroup.rowid IS NULL; + ALTER TABLE llx_usergroup_rights ADD FOREIGN KEY (fk_usergroup) REFERENCES llx_usergroup (rowid);