diff --git a/mysql/migration/1.1.0-2.0.0.sql b/mysql/migration/1.1.0-2.0.0.sql index 60613ead7b9..84492292bae 100644 --- a/mysql/migration/1.1.0-2.0.0.sql +++ b/mysql/migration/1.1.0-2.0.0.sql @@ -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'); diff --git a/pgsql/tables/llx_accountingsystem_det.key.sql b/pgsql/tables/llx_accountingsystem_det.key.sql index 4daa934cf05..23c188967fe 100644 --- a/pgsql/tables/llx_accountingsystem_det.key.sql +++ b/pgsql/tables/llx_accountingsystem_det.key.sql @@ -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); diff --git a/pgsql/tables/llx_bank_account.key.sql b/pgsql/tables/llx_bank_account.key.sql new file mode 100644 index 00000000000..3652d317e22 --- /dev/null +++ b/pgsql/tables/llx_bank_account.key.sql @@ -0,0 +1,28 @@ +-- 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_bank_account ADD UNIQUE uk_bank_account_label (label); diff --git a/pgsql/tables/llx_bank_account.sql b/pgsql/tables/llx_bank_account.sql index 16772373946..8ffbb6a11ba 100644 --- a/pgsql/tables/llx_bank_account.sql +++ b/pgsql/tables/llx_bank_account.sql @@ -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) ); diff --git a/pgsql/tables/llx_bookmark.key.sql b/pgsql/tables/llx_bookmark.key.sql new file mode 100644 index 00000000000..136f1e3cdaa --- /dev/null +++ b/pgsql/tables/llx_bookmark.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_bookmark ADD UNIQUE uk_bookmark_url (fk_user, url); +ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); \ No newline at end of file diff --git a/pgsql/tables/llx_c_currencies.key.sql b/pgsql/tables/llx_c_currencies.key.sql new file mode 100644 index 00000000000..2c7b36ec8b9 --- /dev/null +++ b/pgsql/tables/llx_c_currencies.key.sql @@ -0,0 +1,28 @@ +-- 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. +-- +-- ======================================================================== + + +ALTER TABLE llx_c_currencies ADD UNIQUE uk_c_currencies_code_iso(code_iso); diff --git a/pgsql/tables/llx_c_currencies.sql b/pgsql/tables/llx_c_currencies.sql index 72ad3db869a..0cbf4e87877 100644 --- a/pgsql/tables/llx_c_currencies.sql +++ b/pgsql/tables/llx_c_currencies.sql @@ -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 ); diff --git a/pgsql/tables/llx_c_pays.key.sql b/pgsql/tables/llx_c_pays.key.sql new file mode 100644 index 00000000000..45ec508c3f0 --- /dev/null +++ b/pgsql/tables/llx_c_pays.key.sql @@ -0,0 +1,30 @@ +-- 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. +-- +-- ======================================================================== + + +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); diff --git a/pgsql/tables/llx_c_pays.sql b/pgsql/tables/llx_c_pays.sql index 949aa1ceb11..5cbb195ee6d 100644 --- a/pgsql/tables/llx_c_pays.sql +++ b/pgsql/tables/llx_c_pays.sql @@ -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 ); - - diff --git a/pgsql/tables/llx_c_regions.key.sql b/pgsql/tables/llx_c_regions.key.sql index fdd71624346..6ae53fb2163 100644 --- a/pgsql/tables/llx_c_regions.key.sql +++ b/pgsql/tables/llx_c_regions.key.sql @@ -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); diff --git a/pgsql/tables/llx_c_tva.sql b/pgsql/tables/llx_c_tva.sql index 836e4724ace..b52ed3a874a 100644 --- a/pgsql/tables/llx_c_tva.sql +++ b/pgsql/tables/llx_c_tva.sql @@ -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 ); diff --git a/pgsql/tables/llx_c_type_contact.key.sql b/pgsql/tables/llx_c_type_contact.key.sql new file mode 100644 index 00000000000..fbeefa53077 --- /dev/null +++ b/pgsql/tables/llx_c_type_contact.key.sql @@ -0,0 +1,39 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ======================================================================== +-- Copyright (C) 2005 Patrick Rouillon +-- 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. +-- +-- 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); + diff --git a/pgsql/tables/llx_c_type_contact.sql b/pgsql/tables/llx_c_type_contact.sql new file mode 100644 index 00000000000..bb54146b7c6 --- /dev/null +++ b/pgsql/tables/llx_c_type_contact.sql @@ -0,0 +1,45 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ======================================================================== +-- Copyright (C) 2005 Patrick Rouillon +-- 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. +-- +-- 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 +); diff --git a/pgsql/tables/llx_categorie_association.key.sql b/pgsql/tables/llx_categorie_association.key.sql index d615330a540..b65daf01dc8 100644 --- a/pgsql/tables/llx_categorie_association.key.sql +++ b/pgsql/tables/llx_categorie_association.key.sql @@ -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); diff --git a/pgsql/tables/llx_commande.sql b/pgsql/tables/llx_commande.sql index 74d6d9b8a2b..8f653377ae4 100644 --- a/pgsql/tables/llx_commande.sql +++ b/pgsql/tables/llx_commande.sql @@ -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 diff --git a/pgsql/tables/llx_cond_reglement.sql b/pgsql/tables/llx_cond_reglement.sql index 0db3d8707ec..457d55de305 100644 --- a/pgsql/tables/llx_cond_reglement.sql +++ b/pgsql/tables/llx_cond_reglement.sql @@ -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 diff --git a/pgsql/tables/llx_contrat.key.sql b/pgsql/tables/llx_contrat.key.sql index 23f13e23005..afe092c34dc 100644 --- a/pgsql/tables/llx_contrat.key.sql +++ b/pgsql/tables/llx_contrat.key.sql @@ -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; diff --git a/pgsql/tables/llx_contrat.sql b/pgsql/tables/llx_contrat.sql index bef37859eb2..cc6b39630b4 100644 --- a/pgsql/tables/llx_contrat.sql +++ b/pgsql/tables/llx_contrat.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,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 diff --git a/pgsql/tables/llx_contratdet.key.sql b/pgsql/tables/llx_contratdet.key.sql index 942d19899f0..c0bbc968466 100644 --- a/pgsql/tables/llx_contratdet.key.sql +++ b/pgsql/tables/llx_contratdet.key.sql @@ -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); diff --git a/pgsql/tables/llx_contratdet.sql b/pgsql/tables/llx_contratdet.sql index 33ae84ec241..1f0e0979e13 100644 --- a/pgsql/tables/llx_contratdet.sql +++ b/pgsql/tables/llx_contratdet.sql @@ -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, diff --git a/pgsql/tables/llx_element_contact.key.sql b/pgsql/tables/llx_element_contact.key.sql new file mode 100644 index 00000000000..8575b54d66e --- /dev/null +++ b/pgsql/tables/llx_element_contact.key.sql @@ -0,0 +1,33 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2005 patrick Rouillon +-- +-- 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); diff --git a/pgsql/tables/llx_element_contact.sql b/pgsql/tables/llx_element_contact.sql new file mode 100644 index 00000000000..810e9ca97f2 --- /dev/null +++ b/pgsql/tables/llx_element_contact.sql @@ -0,0 +1,40 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2005 patrick Rouillon +-- +-- 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 +); + diff --git a/pgsql/tables/llx_facture.key.sql b/pgsql/tables/llx_facture.key.sql index 9d423b45d28..365604c3015 100644 --- a/pgsql/tables/llx_facture.key.sql +++ b/pgsql/tables/llx_facture.key.sql @@ -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); diff --git a/pgsql/tables/llx_facture.sql b/pgsql/tables/llx_facture.sql index 19da87c0c51..fa164839084 100644 --- a/pgsql/tables/llx_facture.sql +++ b/pgsql/tables/llx_facture.sql @@ -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) ); diff --git a/pgsql/tables/llx_facture_fourn.key.sql b/pgsql/tables/llx_facture_fourn.key.sql index 366d2390513..58076b8ab54 100644 --- a/pgsql/tables/llx_facture_fourn.key.sql +++ b/pgsql/tables/llx_facture_fourn.key.sql @@ -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); diff --git a/pgsql/tables/llx_facture_tva_sum.key.sql b/pgsql/tables/llx_facture_tva_sum.key.sql index 7fffb9a2954..76d230c1386 100644 --- a/pgsql/tables/llx_facture_tva_sum.key.sql +++ b/pgsql/tables/llx_facture_tva_sum.key.sql @@ -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); diff --git a/pgsql/tables/llx_facturedet.key.sql b/pgsql/tables/llx_facturedet.key.sql index 3ac0536473e..8f0c870b04c 100644 --- a/pgsql/tables/llx_facturedet.key.sql +++ b/pgsql/tables/llx_facturedet.key.sql @@ -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); diff --git a/pgsql/tables/llx_facturedet.sql b/pgsql/tables/llx_facturedet.sql index 279955ff0fe..b501d668928 100644 --- a/pgsql/tables/llx_facturedet.sql +++ b/pgsql/tables/llx_facturedet.sql @@ -4,7 +4,7 @@ -- =================================================================== -- Copyright (C) 2001-2005 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 @@ -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é diff --git a/pgsql/tables/llx_fichinter.key.sql b/pgsql/tables/llx_fichinter.key.sql index dde44bb14f5..88dcb70e113 100644 --- a/pgsql/tables/llx_fichinter.key.sql +++ b/pgsql/tables/llx_fichinter.key.sql @@ -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); diff --git a/pgsql/tables/llx_mailing_cibles.sql b/pgsql/tables/llx_mailing_cibles.sql index a19c62dfb21..c8f480d4702 100644 --- a/pgsql/tables/llx_mailing_cibles.sql +++ b/pgsql/tables/llx_mailing_cibles.sql @@ -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 ); diff --git a/pgsql/tables/llx_paiement_facture.key.sql b/pgsql/tables/llx_paiement_facture.key.sql index 01f4e31caff..4c5f4cc0163 100644 --- a/pgsql/tables/llx_paiement_facture.key.sql +++ b/pgsql/tables/llx_paiement_facture.key.sql @@ -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); diff --git a/pgsql/tables/llx_paiementfourn_facturefourn.sql b/pgsql/tables/llx_paiementfourn_facturefourn.sql new file mode 100644 index 00000000000..b9262f1c53a --- /dev/null +++ b/pgsql/tables/llx_paiementfourn_facturefourn.sql @@ -0,0 +1,36 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2005 Marc Barilley / Océbo +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- +-- =========================================================================== + +CREATE TABLE 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`) +); diff --git a/pgsql/tables/llx_prelevement_facture.key.sql b/pgsql/tables/llx_prelevement_facture.key.sql index 2e1cdf1657b..50423ca7194 100644 --- a/pgsql/tables/llx_prelevement_facture.key.sql +++ b/pgsql/tables/llx_prelevement_facture.key.sql @@ -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); diff --git a/pgsql/tables/llx_prelevement_lignes.key.sql b/pgsql/tables/llx_prelevement_lignes.key.sql index 4477cb9c0b9..955d6fd1e88 100644 --- a/pgsql/tables/llx_prelevement_lignes.key.sql +++ b/pgsql/tables/llx_prelevement_lignes.key.sql @@ -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); diff --git a/pgsql/tables/llx_prelevement_rejet.sql b/pgsql/tables/llx_prelevement_rejet.sql index 4f5b05b1f2e..bbd3280742f 100644 --- a/pgsql/tables/llx_prelevement_rejet.sql +++ b/pgsql/tables/llx_prelevement_rejet.sql @@ -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 ); diff --git a/pgsql/tables/llx_product.key.sql b/pgsql/tables/llx_product.key.sql new file mode 100644 index 00000000000..31ee728a350 --- /dev/null +++ b/pgsql/tables/llx_product.key.sql @@ -0,0 +1,30 @@ +-- Generated from dolibarr_mysql2pgsql +-- (c) 2004, PostgreSQL Inc. +-- (c) 2005, Laurent Destailleur. + +-- ============================================================================ +-- Copyright (C) 2002-2004 Rodolphe Quiedeville +-- 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 +-- 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); + diff --git a/pgsql/tables/llx_product.sql b/pgsql/tables/llx_product.sql index bed08786a2a..07799b1fea4 100644 --- a/pgsql/tables/llx_product.sql +++ b/pgsql/tables/llx_product.sql @@ -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, diff --git a/pgsql/tables/llx_product_fournisseur_price.key.sql b/pgsql/tables/llx_product_fournisseur_price.key.sql index 014b6cba01b..8a6394f2175 100644 --- a/pgsql/tables/llx_product_fournisseur_price.key.sql +++ b/pgsql/tables/llx_product_fournisseur_price.key.sql @@ -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); diff --git a/pgsql/tables/llx_projet_task_time.sql b/pgsql/tables/llx_projet_task_time.sql index dfebcfafb88..ec1e46ff5ee 100644 --- a/pgsql/tables/llx_projet_task_time.sql +++ b/pgsql/tables/llx_projet_task_time.sql @@ -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 ); diff --git a/pgsql/tables/llx_propal.key.sql b/pgsql/tables/llx_propal.key.sql index e1af9b90e41..be5cffffa78 100644 --- a/pgsql/tables/llx_propal.key.sql +++ b/pgsql/tables/llx_propal.key.sql @@ -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); diff --git a/pgsql/tables/llx_propal.sql b/pgsql/tables/llx_propal.sql index 61db2c47a6f..e37d96e0b64 100644 --- a/pgsql/tables/llx_propal.sql +++ b/pgsql/tables/llx_propal.sql @@ -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) diff --git a/pgsql/tables/llx_societe_consult.sql b/pgsql/tables/llx_societe_consult.sql new file mode 100644 index 00000000000..b420ab1d462 --- /dev/null +++ b/pgsql/tables/llx_societe_consult.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$ +-- +-- ======================================================================== +-- +-- 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')) +); + diff --git a/pgsql/tables/llx_societe_perms.sql b/pgsql/tables/llx_societe_perms.sql new file mode 100644 index 00000000000..2fc050d3e48 --- /dev/null +++ b/pgsql/tables/llx_societe_perms.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_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) +); + diff --git a/pgsql/tables/llx_societe_remise_except.key.sql b/pgsql/tables/llx_societe_remise_except.key.sql index 2114908dad6..234d43a729c 100644 --- a/pgsql/tables/llx_societe_remise_except.key.sql +++ b/pgsql/tables/llx_societe_remise_except.key.sql @@ -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); diff --git a/pgsql/tables/llx_socpeople.key.sql b/pgsql/tables/llx_socpeople.key.sql index 4436b3548e3..570cc798e8f 100644 --- a/pgsql/tables/llx_socpeople.key.sql +++ b/pgsql/tables/llx_socpeople.key.sql @@ -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); diff --git a/pgsql/tables/llx_user.sql b/pgsql/tables/llx_user.sql index 67f927f4c05..05b65081a18 100644 --- a/pgsql/tables/llx_user.sql +++ b/pgsql/tables/llx_user.sql @@ -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), diff --git a/pgsql/tables/llx_user_rights.key.sql b/pgsql/tables/llx_user_rights.key.sql index d5689536fae..b470c06bf05 100644 --- a/pgsql/tables/llx_user_rights.key.sql +++ b/pgsql/tables/llx_user_rights.key.sql @@ -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); diff --git a/pgsql/tables/llx_usergroup_rights.key.sql b/pgsql/tables/llx_usergroup_rights.key.sql index afded2e8f61..a6552eb43c9 100644 --- a/pgsql/tables/llx_usergroup_rights.key.sql +++ b/pgsql/tables/llx_usergroup_rights.key.sql @@ -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);