Mise a jour script pour prparation release

This commit is contained in:
Laurent Destailleur 2005-12-17 15:31:05 +00:00
parent e5f2332034
commit c55deb5adf
48 changed files with 502 additions and 69 deletions

View File

@ -538,6 +538,8 @@ alter table llx_bank_account add account_number varchar(8) after clos ;
alter table llx_bank_account add rappro smallint DEFAULT 1 after clos;
alter table llx_bank_account modify label varchar(30) unique;
update llx_bank_account set account_number = '51' where account_number is null;
ALTER TABLE llx_bank_account drop index label;
ALTER TABLE llx_bank_account ADD UNIQUE uk_bank_account_label (label);
alter table llx_paiement add fk_bank integer NOT NULL after note ;
alter table llx_paiementfourn add fk_bank integer NOT NULL after note ;
@ -1682,6 +1684,10 @@ create table llx_c_currencies
active tinyint DEFAULT 1 NOT NULL
)type=innodb;
ALTER TABLE llx_c_currencies DROP INDEX code_iso;
ALTER TABLE llx_c_currencies ADD UNIQUE uk_c_currencies_code_iso(code_iso);
insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'BT', 'THB', 1, 'Bath thailandais');
insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CD', 'DKK', 1, 'Couronnes dannoises');
insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CN', 'NOK', 1, 'Couronnes norvegiennes');

View File

@ -29,4 +29,4 @@
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);
ALTER TABLE llx_accountingsystem_det ADD CONSTRAINT fk_accountingsystem_det_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accountingsystem (pcg_version);

View File

@ -0,0 +1,28 @@
-- 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_bank_account ADD UNIQUE uk_bank_account_label (label);

View File

@ -34,7 +34,7 @@ create table llx_bank_account
rowid SERIAL PRIMARY KEY,
"datec" timestamp,
"tms" timestamp,
"label" varchar(30) UNIQUE,
"label" varchar(30),
"bank" varchar(60),
"code_banque" varchar(7),
"code_guichet" varchar(6),
@ -47,5 +47,6 @@ create table llx_bank_account
"adresse_proprio" varchar(255),
"courant" smallint DEFAULT 0 NOT NULL,
"clos" smallint DEFAULT 0 NOT NULL,
"rappro" smallint DEFAULT 1,
"account_number" varchar(8)
);

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_bookmark ADD UNIQUE uk_bookmark_url (fk_user, url);
ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title);

View File

@ -0,0 +1,28 @@
-- 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.
--
-- ========================================================================
ALTER TABLE llx_c_currencies ADD UNIQUE uk_c_currencies_code_iso(code_iso);

View File

@ -26,8 +26,8 @@
create table llx_c_currencies
(
code varchar(2) UNIQUE PRIMARY KEY,
"code_iso" varchar(3) UNIQUE NOT NULL,
code varchar(2) PRIMARY KEY,
"code_iso" varchar(3) NOT NULL,
"label" varchar(64),
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -0,0 +1,30 @@
-- 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.
--
-- ========================================================================
ALTER TABLE llx_c_pays ADD UNIQUE INDEX idx_c_pays_code (code);
ALTER TABLE llx_c_pays ADD UNIQUE INDEX idx_c_pays_code_iso (code_iso);
ALTER TABLE llx_c_pays ADD UNIQUE INDEX idx_c_pays_libelle (libelle);

View File

@ -27,10 +27,9 @@
create table llx_c_pays
(
rowid integer PRIMARY KEY,
"code" varchar(6) UNIQUE NOT NULL,
rowid integer PRIMARY KEY,
"code" varchar(2) NOT NULL,
"code_iso" varchar(3) ,
"libelle" varchar(25) NOT NULL,
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -26,4 +26,4 @@
ALTER TABLE llx_c_regions ADD INDEX idx_c_regions_fk_pays (fk_pays);
ALTER TABLE llx_c_regions ADD CONSTRAINT c_regions_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_pays (rowid);
ALTER TABLE llx_c_regions ADD CONSTRAINT fk_c_regions_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_pays (rowid);

View File

@ -29,8 +29,8 @@ create table llx_c_tva
(
rowid SERIAL PRIMARY KEY,
"fk_pays" integer NOT NULL,
"taux" real NOT NULL,
"recuperableonly" integer DEFAULT 0,
"taux" real NOT NULL,
"recuperableonly" integer NOT NULL DEFAULT 0,
"note" varchar(128),
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -0,0 +1,39 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ========================================================================
-- Copyright (C) 2005 Patrick Rouillon <patrick.rouillon.net>
-- 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.
--
-- Defini les types de contact d'un element sert de reference pour
-- la table llx_element_contact
--
-- element est le nom de la table utilisant le type de contact.
-- i.e. contact, facture, projet, societe (sans le llx_ devant).
-- Libelle est un texte décrivant le type de contact.
-- active précide si cette valeur est active ou 'archivé'.
--
-- ========================================================================
ALTER TABLE llx_c_type_contact
ADD UNIQUE INDEX idx_c_type_contact_uk (element, source, code);

View File

@ -0,0 +1,45 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ========================================================================
-- Copyright (C) 2005 Patrick Rouillon <patrick.rouillon.net>
-- 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.
--
-- Defini les types de contact d'un element sert de reference pour
-- la table llx_element_contact
--
-- element est le nom de la table utilisant le type de contact.
-- i.e. contact, facture, projet, societe (sans le llx_ devant).
-- Libelle est un texte décrivant le type de contact.
-- active précide si cette valeur est active ou 'archivé'.
--
-- ========================================================================
create table llx_c_type_contact
(
rowid integer PRIMARY KEY,
"element" varchar(30) NOT NULL,
"source" varchar(8) DEFAULT 'external' NOT NULL,
"code" varchar(16) NOT NULL,
"libelle" varchar(64) NOT NULL,
"active" smallint DEFAULT 1 NOT NULL
);

View File

@ -27,5 +27,5 @@
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);
ALTER TABLE llx_categorie_association ADD CONSTRAINT fk_categorie_asso_fk_categorie_mere FOREIGN KEY (fk_categorie_mere) REFERENCES llx_categorie (rowid);
ALTER TABLE llx_categorie_association ADD CONSTRAINT fk_categorie_asso_fk_categorie_fille FOREIGN KEY (fk_categorie_fille) REFERENCES llx_categorie (rowid);

View File

@ -31,7 +31,8 @@ create table llx_commande
"fk_soc" integer,
"fk_soc_contact" integer,
"fk_projet" integer DEFAULT 0, -- projet auquel est rattache la commande
"ref" varchar(30) NOT NULL, -- propal number
"ref" varchar(30) NOT NULL, -- order number
"ref_client" varchar(30), -- customer order number
"date_creation" timestamp, -- date de creation
"date_valid" timestamp, -- date de validation
"date_cloture" timestamp, -- date de cloture

View File

@ -29,7 +29,7 @@ create table llx_cond_reglement
rowid integer PRIMARY KEY,
"code" varchar(16),
"sortorder" smallint,
"actif" smallint DEFAULT 1,
"active" smallint DEFAULT 1,
"libelle" varchar(255),
"libelle_facture" text,
"fdm" smallint, -- reglement fin de mois

View File

@ -27,6 +27,7 @@
-- Supprimme orhpelins pour permettre montée de la clé
-- V4 DELETE llx_contratdet FROM llx_contratdet, llx_contrat LEFT JOIN llx_societe ON llx_contrat.fk_soc = llx_societe.idp WHERE llx_contratdet.fk_contrat = llx_contrat.rowid AND 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;

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,10 +25,10 @@
--
-- ============================================================================
create table llx_contrat
(
rowid SERIAL PRIMARY KEY,
"ref" varchar(30), -- reference de contrat
"tms" timestamp,
"datec" timestamp, -- date de creation de l'enregistrement
"date_contrat" timestamp,
@ -38,8 +38,8 @@ create table llx_contrat
"date_cloture" timestamp,
"fk_soc" integer NOT NULL,
"fk_projet" integer,
"fk_commercial_signature" integer NOT NULL,
"fk_commercial_suivi" integer NOT NULL,
"fk_commercial_signature" integer NOT NULL, -- obsolete
"fk_commercial_suivi" integer NOT NULL, -- obsolete
"fk_user_author" integer NOT NULL default 0,
"fk_user_mise_en_service" integer,
"fk_user_cloture" integer

View File

@ -32,5 +32,5 @@ ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_date_ouverture_prevue (date_
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);
ALTER TABLE llx_contratdet ADD CONSTRAINT fk_contratdet_fk_contrat FOREIGN KEY (fk_contrat) REFERENCES llx_contrat (rowid);
ALTER TABLE llx_contratdet ADD CONSTRAINT fk_contratdet_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);

View File

@ -36,7 +36,7 @@ create table llx_contratdet
rowid SERIAL PRIMARY KEY,
"tms" timestamp,
"fk_contrat" integer NOT NULL,
"fk_product" integer NOT NULL,
"fk_product" integer NULL, -- doit pouvoir etre nul pour ligne detail sans produits
"statut" smallint DEFAULT 0,
"label" text, -- libellé du produit
"description" text,

View File

@ -0,0 +1,33 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2005 patrick Rouillon <patrick@rouillon.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_element_contact
ADD UNIQUE INDEX idx_element_contact_idx1 (element_id, fk_c_type_contact, fk_socpeople);
ALTER TABLE llx_element_contact
ADD CONSTRAINT fk_element_contact_fk_c_type_contact
FOREIGN KEY (fk_c_type_contact) REFERENCES llx_c_type_contact(rowid);

View File

@ -0,0 +1,40 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2005 patrick Rouillon <patrick@rouillon.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$
--
-- Association de personnes/societes avec un element de la base (contrat, projet, propal).
-- Permet de definir plusieur type d'intervenant sur un element.
-- i.e. commercial, adresse de facturation, prestataire...
-- ============================================================================
create table llx_element_contact
(
rowid SERIAL PRIMARY KEY,
"datecreate" timestamp NULL, -- date de creation de l'enregistrement
"statut" smallint DEFAULT 5, -- 5 inactif, 4 actif
"element_id" int NOT NULL, -- la reference de l'element.
"fk_c_type_contact" int NOT NULL, -- nature du contact.
"fk_socpeople" integer NOT NULL
);

View File

@ -31,7 +31,7 @@ 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);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);

View File

@ -32,26 +32,29 @@
create table llx_facture
(
rowid SERIAL PRIMARY KEY,
"facnumber" varchar(50) NOT NULL,
"facnumber" varchar(30) NOT NULL,
"ref_client" varchar(30),
"increment" varchar(10),
"fk_soc" integer NOT NULL,
"datec" timestamp, -- date de creation de la facture
"datef" date, -- date de la facture
"date_valid" date, -- date de validation
"paye" smallint DEFAULT 0 NOT NULL,
"amount" real DEFAULT 0 NOT NULL,
"remise_percent" real DEFAULT 0, -- remise globale en pourcent
"remise" real DEFAULT 0,
"remise_percent" real DEFAULT 0,
"tva" real DEFAULT 0,
"total" real DEFAULT 0,
"total_ttc" real DEFAULT 0,
"tva" real DEFAULT 0, -- montant tva apres remise globale
"total" real DEFAULT 0, -- montant total ht apres remise globale
"total_ttc" real DEFAULT 0, -- montant total ttc apres remise globale
"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 ...)
"fk_mode_reglement" integer, -- mode de reglement (Virement, Prélèvement)
"date_lim_reglement" date, -- date limite de reglement
"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
"note" text,
"model" varchar(50),
UNIQUE(facnumber)
);

View File

@ -30,7 +30,7 @@ ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_fk_user_author (fk_use
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);
ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);

View File

@ -29,4 +29,4 @@
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);
ALTER TABLE llx_facture_tva_sum ADD CONSTRAINT fk_facture_tva_sum_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid);

View File

@ -25,7 +25,7 @@
-- Supprimme orhpelins pour permettre montée de la clé
DELETE llx_facturedet FROM llx_facturedet LEFT JOIN llx_facture ON llx_facturedet.fk_facture = llx_facture.rowid WHERE llx_facture.rowid IS NULL;
--DELETE llx_facturedet FROM llx_facturedet LEFT JOIN llx_facture ON llx_facturedet.fk_facture = llx_facture.rowid WHERE llx_facture.rowid IS NULL;
ALTER TABLE llx_facturedet ADD INDEX idx_facturedet_fk_facture (fk_facture);
ALTER TABLE llx_facturedet ADD CONSTRAINT facturedet_fk_facture_rowid FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid);
ALTER TABLE llx_facturedet ADD CONSTRAINT fk_facturedet_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid);

View File

@ -4,7 +4,7 @@
-- ===================================================================
-- Copyright (C) 2001-2005 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
@ -28,7 +28,7 @@ create table llx_facturedet
(
rowid SERIAL PRIMARY KEY,
"fk_facture" integer NOT NULL,
"fk_product" integer DEFAULT 0 NOT NULL,
"fk_product" integer NULL, -- doit pouvoir etre nul pour ligne detail sans produits
"description" text,
"tva_taux" real DEFAULT 19.6, -- taux tva
"qty" real, -- quantité

View File

@ -26,4 +26,4 @@
ALTER TABLE llx_fichinter ADD INDEX idx_fichinter_fk_soc (fk_soc);
ALTER TABLE llx_fichinter ADD CONSTRAINT fichinter_fk_soc_idp FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
ALTER TABLE llx_fichinter ADD CONSTRAINT fk_fichinter_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);

View File

@ -35,6 +35,7 @@ create table llx_mailing_cibles
"prenom" varchar(160),
"email" varchar(160) NOT NULL,
"statut" smallint NOT NULL DEFAULT 0,
"url" varchar(160),
"date_envoi" timestamp
);

View File

@ -29,7 +29,7 @@
-- 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);
ALTER TABLE llx_paiement_facture ADD CONSTRAINT fk_paiement_facture_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid);
ALTER TABLE llx_paiement_facture ADD INDEX idx_paiement_facture_fk_paiement (fk_paiement);
ALTER TABLE llx_paiement_facture ADD CONSTRAINT paiement_facture_fk_paiement FOREIGN KEY (fk_paiement) REFERENCES llx_paiement (rowid);
ALTER TABLE llx_paiement_facture ADD CONSTRAINT fk_paiement_facture_fk_paiement FOREIGN KEY (fk_paiement) REFERENCES llx_paiement (rowid);

View File

@ -0,0 +1,36 @@
-- Generated from dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Marc Barilley / Océbo <marc@ocebo.com>
--
-- 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 IF NOT EXISTS `llx_paiementfourn_facturefourn` (
SERIAL PRIMARY KEY,
"`fk_paiementfourn`" int4 default NULL,
"`fk_facturefourn`" int4 default NULL,
"`amount`" real default '0',
PRIMARY KEY (`rowid`),
"UNIQUE" (`fk_facturefourn`),
"UNIQUE" (`fk_paiementfourn`)
);

View File

@ -29,5 +29,5 @@
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);
ALTER TABLE llx_prelevement_facture ADD CONSTRAINT fk_prelevement_facture_fk_prelevement_lignes FOREIGN KEY (fk_prelevement_lignes) REFERENCES llx_prelevement_lignes (rowid);

View File

@ -29,5 +29,5 @@
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);
ALTER TABLE llx_prelevement_lignes ADD CONSTRAINT fk_prelevement_lignes_fk_prelevement_bons FOREIGN KEY (fk_prelevement_bons) REFERENCES llx_prelevement_bons (rowid);

View File

@ -25,7 +25,6 @@
--
--
create table llx_prelevement_rejet
(
rowid SERIAL PRIMARY KEY,
@ -34,5 +33,7 @@ create table llx_prelevement_rejet
"motif" integer,
"date_creation" timestamp,
"fk_user_creation" integer,
"note" text
"note" text,
"afacturer" smallint default 0,
"fk_facture" integer
);

View File

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

View File

@ -30,7 +30,7 @@ create table llx_product
rowid SERIAL PRIMARY KEY,
"datec" timestamp,
"tms" timestamp,
"ref" varchar(15) UNIQUE NOT NULL,
"ref" varchar(16) NOT NULL,
"label" varchar(128),
"description" varchar(255),
"note" text,

View File

@ -30,8 +30,8 @@ ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_product_fournisseur_pric
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);
ALTER TABLE llx_product_fournisseur_price ADD FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);

View File

@ -31,7 +31,7 @@ create table llx_projet_task_time
rowid SERIAL PRIMARY KEY,
"fk_task" integer NOT NULL,
"task_date" date,
"task_duration" smallint,
"task_duration" real UNSIGNED,
"fk_user" integer,
"note" text
);

View File

@ -29,5 +29,5 @@
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);
ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);

View File

@ -24,6 +24,9 @@
--
-- ===================================================================
create table llx_propal
(
rowid SERIAL PRIMARY KEY,
@ -32,19 +35,22 @@ create table llx_propal
"fk_projet" integer DEFAULT 0, -- projet auquel est rattache la propale
"ref" varchar(30) NOT NULL, -- propal number
"datec" timestamp, -- date de creation
"datep" date, -- date de la propal
"fin_validite" timestamp, -- date de fin de validite
"date_valid" timestamp, -- date de validation
"date_cloture" timestamp, -- date de cloture
"datep" date, -- date de la propal
"fk_user_author" integer, -- createur de la propale
"fk_user_valid" integer, -- valideur de la propale
"fk_user_cloture" integer, -- cloture de la propale signee ou non signee
"fk_statut" smallint DEFAULT 0,
"fk_statut" smallint DEFAULT 0 NOT NULL,
"price" real DEFAULT 0,
"remise_percent" real DEFAULT 0,
"remise_percent" real DEFAULT 0, -- remise globale en pourcent
"remise" real DEFAULT 0,
"tva" real DEFAULT 0,
"total" real DEFAULT 0,
"tva" real DEFAULT 0, -- montant tva apres remise globale
"total_ht" real DEFAULT 0, -- montant total ht apres remise globale
"total" real DEFAULT 0, -- montant total ttc apres remise globale
"fk_cond_reglement" integer, -- condition de reglement (30 jours, fin de mois ...)
"fk_mode_reglement" integer, -- mode de reglement (Virement, Prélèvement)
"note" text,
"model_pdf" varchar(50),
UNIQUE(ref)

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$
--
-- ========================================================================
--
-- Le type InnoDB n'est pas nécessaire pour cette table
--
create table llx_societe_consult
(
"fk_soc" integer,
"fk_user" integer,
"datec" timestamp,
"action" varchar(1) CHECK (action IN ('w','r'))
);

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_societe_perms
(
"fk_soc" integer,
"fk_user" integer,
"pread" smallint DEFAULT 0, -- permission de lecture
"pwrite" smallint DEFAULT 0, -- permission d'ecriture
"pperms" smallint DEFAULT 0, -- permission sur les permissions
UNIQUE(fk_soc, fk_user)
);

View File

@ -34,9 +34,9 @@ ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_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 FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
ALTER TABLE llx_societe_remise_except ADD FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
ALTER TABLE llx_societe_remise_except ADD FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid);
ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid);

View File

@ -26,4 +26,4 @@
ALTER TABLE llx_socpeople ADD INDEX idx_socpeople_fk_soc (fk_soc);
ALTER TABLE llx_socpeople ADD CONSTRAINT socpeople_fk_soc_idp FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
ALTER TABLE llx_socpeople ADD CONSTRAINT fk_socpeople_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);

View File

@ -29,11 +29,14 @@ create table llx_user
rowid SERIAL PRIMARY KEY,
"datec" timestamp,
"tms" timestamp,
"login" varchar(8),
"login" varchar(24),
"pass" varchar(32),
"name" varchar(50),
"firstname" varchar(50),
"code" varchar(4),
"office_phone" varchar(20),
"office_fax" varchar(20),
"user_mobile" varchar(20),
"email" varchar(255),
"admin" smallint DEFAULT 0,
"webcal_login" varchar(25),

View File

@ -27,7 +27,7 @@
-- 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);
ALTER TABLE llx_user_rights ADD CONSTRAINT fk_user_rights_fk_user_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);

View File

@ -29,4 +29,4 @@
-- 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);
ALTER TABLE llx_usergroup_rights ADD CONSTRAINT fk_usergroup_rights_fk_usergroup FOREIGN KEY (fk_usergroup) REFERENCES llx_usergroup (rowid);