Mise a jours scripts pgsql

This commit is contained in:
Laurent Destailleur 2005-08-23 23:45:33 +00:00
parent de2ac324e7
commit ab2cec7ae3
47 changed files with 668 additions and 94 deletions

View File

@ -0,0 +1,36 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
-- $Source$
--
-- ============================================================================
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
);

View File

@ -0,0 +1,32 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
-- $Source$
--
-- ===========================================================================
ALTER TABLE llx_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);

View File

@ -0,0 +1,36 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
-- $Source$
--
-- ============================================================================
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)
);

View File

@ -0,0 +1,31 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
-- $Source$
--
-- ===========================================================================
ALTER TABLE llx_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);

View File

@ -4,6 +4,7 @@
-- ========================================================================
-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- $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,

View File

@ -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)

View File

@ -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'))
);

View File

@ -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)
);

View File

@ -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

View File

@ -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);

View File

@ -0,0 +1,37 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ========================================================================
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- $Id$
-- $Source$
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- ========================================================================
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
);

View File

@ -3,8 +3,9 @@
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2005 Brice Davoleau <e1davole@iu-vannes.fr>
-- Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
-- Copyright (C) 2005 Brice Davoleau <e1davole@iu-vannes.fr>
-- Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -3,8 +3,9 @@
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2005 Brice Davoleau <e1davole@iu-vannes.fr>
-- Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
-- Copyright (C) 2005 Brice Davoleau <e1davole@iu-vannes.fr>
-- Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -4,7 +4,7 @@
-- ============================================================================
-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -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,

View File

@ -4,6 +4,7 @@
-- ============================================================================
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -0,0 +1,36 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ===================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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
);

View File

@ -0,0 +1,31 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ===================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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
);

View File

@ -0,0 +1,37 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ===================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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
);

View File

@ -0,0 +1,35 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ===================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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
);

View File

@ -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),

View File

@ -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);

View File

@ -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);

View File

@ -0,0 +1,36 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
-- $Source$
--
-- ============================================================================
ALTER TABLE llx_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);

View File

@ -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)
);

View File

@ -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);

View File

@ -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);

View File

@ -3,7 +3,7 @@
-- (c) 2005, Laurent Destailleur.
-- ===================================================================
-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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
);

View File

@ -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
);

View File

@ -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);

View File

@ -4,6 +4,7 @@
-- ============================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -4,6 +4,7 @@
-- ============================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -0,0 +1,39 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ===================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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)
);

View File

@ -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,

View File

@ -4,6 +4,7 @@
-- ============================================================================
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -0,0 +1,43 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ===========================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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);

View File

@ -0,0 +1,38 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ===========================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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);

View File

@ -0,0 +1,40 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ===========================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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);

View File

@ -4,7 +4,7 @@
-- ============================================================================
-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -0,0 +1,29 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ===================================================================
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
-- $Source$
--
-- ===================================================================
ALTER TABLE llx_societe ADD UNIQUE uk_societe_prefix_comm(prefix_comm);
ALTER TABLE llx_societe ADD UNIQUE uk_societe_code_client(code_client);

View File

@ -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);

View File

@ -4,6 +4,7 @@
-- ============================================================================
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -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),

View File

@ -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)
);

View File

@ -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)
);

View File

@ -4,6 +4,7 @@
-- ============================================================================
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -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);