From 9b891ca98f4e2c2462139ece99c6d95d49fc00fe Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Sat, 1 Sep 2007 15:03:38 +0000
Subject: [PATCH] =?UTF-8?q?mise=20=E0=20jour=20des=20tables=20Postgresql?=
 =?UTF-8?q?=20avec=20le=20script=20de=20migration?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 pgsql/tables/llx_bank_url.sql         |  2 +-
 pgsql/tables/llx_bordereau_cheque.sql |  4 +--
 pgsql/tables/llx_facturedet.sql       |  4 +--
 pgsql/tables/llx_fichinter.sql        |  5 ++--
 pgsql/tables/llx_fichinterdet.sql     | 35 ++++++++++++++++++++++++
 pgsql/tables/llx_osc_categories.sql   | 38 +++++++++++++++------------
 pgsql/tables/llx_osc_customer.sql     | 16 ++++++-----
 pgsql/tables/llx_osc_order.sql        | 16 ++++++-----
 pgsql/tables/llx_osc_product.sql      | 16 ++++++-----
 pgsql/tables/llx_societe_remise.sql   |  3 +--
 10 files changed, 92 insertions(+), 47 deletions(-)
 create mode 100644 pgsql/tables/llx_fichinterdet.sql

diff --git a/pgsql/tables/llx_bank_url.sql b/pgsql/tables/llx_bank_url.sql
index 69b0bdd8614..c8a4a341566 100644
--- a/pgsql/tables/llx_bank_url.sql
+++ b/pgsql/tables/llx_bank_url.sql
@@ -32,5 +32,5 @@ create table llx_bank_url
   "url_id"          integer,
   "url"             varchar(255),
   "label"           varchar(255),
-  "type"            enum("?","company","payment","payment_supplier","member","subscription","donation","sc","payment_sc") NOT NULL
+  "type" varchar(16) CHECK (type IN ('?','company','payment','payment_supplier','member','subscription','donation','sc','payment_sc'))  NOT NULL
 );
diff --git a/pgsql/tables/llx_bordereau_cheque.sql b/pgsql/tables/llx_bordereau_cheque.sql
index b17b41d2325..0d9965d855d 100644
--- a/pgsql/tables/llx_bordereau_cheque.sql
+++ b/pgsql/tables/llx_bordereau_cheque.sql
@@ -5,7 +5,7 @@
 -- ===================================================================
 -- Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
 --
--- $Id: llx_bordereau_cheque.sql,v 1.3 2006/12/22 14:38:16 rodolphe Exp $
+-- $Id: llx_bordereau_cheque.sql,v 1.4 2007/08/26 19:21:40 eldy Exp $
 -- $Source: /cvsroot/dolibarr/dolibarr/mysql/tables/llx_bordereau_cheque.sql,v $
 --
 -- This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@ create table llx_bordereau_cheque
   rowid SERIAL PRIMARY KEY,
   "datec"             timestamp,
   "date_bordereau"    date,
-  "number"            mediumint ZEROFILL,
+  "number"            integer,
   "amount"            float(12,2),
   "nbcheque"          smallint DEFAULT 0,
   "fk_bank_account"   integer,
diff --git a/pgsql/tables/llx_facturedet.sql b/pgsql/tables/llx_facturedet.sql
index ea82aebe511..9c184587a17 100644
--- a/pgsql/tables/llx_facturedet.sql
+++ b/pgsql/tables/llx_facturedet.sql
@@ -45,6 +45,6 @@ create table llx_facturedet
   "info_bits"		  integer DEFAULT 0, 	-- TVA NPR ou non
   "fk_code_ventilation" integer DEFAULT 0 NOT NULL,
   "fk_export_compta"    integer DEFAULT 0 NOT NULL,
-  "rang"                integer DEFAULT 0,  -- ordre d'affichage
-  "special_code"    smallint unsiDEFAULT 0, -- code pour les lignes speciales (livraison=1, ecotaxe=2)
+  "rang"                integer DEFAULT 0,         -- ordre d'affichage
+  "special_code"    int2 DEFAULT 0   -- code pour les lignes speciales (livraison=1, ecotaxe=2)
 );
diff --git a/pgsql/tables/llx_fichinter.sql b/pgsql/tables/llx_fichinter.sql
index a9c76470bce..be80c3e7a14 100644
--- a/pgsql/tables/llx_fichinter.sql
+++ b/pgsql/tables/llx_fichinter.sql
@@ -35,14 +35,15 @@ create table llx_fichinter
   "tms"             timestamp,
   "datec"           timestamp,              -- date de creation 
   "date_valid"      timestamp,              -- date de validation
-  "datei"           date,                  -- date de l'intervention
+  "datei"           date,                  -- date de livraison du bon d'intervention
   "fk_user_author"  integer,               -- createur de la fiche
   "fk_user_valid"   integer,               -- valideur de la fiche
   "fk_statut"       smallint  DEFAULT 0,
-  "duree"           real,
+  "duree"           real,                  -- dur�e totale de l'intervention
   "description"     text,
   "note_private"    text,
   "note_public"     text,
+  "model_pdf"       varchar(50),
   UNIQUE(ref)
 );
 
diff --git a/pgsql/tables/llx_fichinterdet.sql b/pgsql/tables/llx_fichinterdet.sql
new file mode 100644
index 00000000000..3a4713dc6e2
--- /dev/null
+++ b/pgsql/tables/llx_fichinterdet.sql
@@ -0,0 +1,35 @@
+-- Generated from dolibarr_mysql2pgsql
+-- (c) 2004, PostgreSQL Inc.
+-- (c) 2005, Laurent Destailleur.
+
+-- ===================================================================
+-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+-- Copyright (C) 2005-2007 Regis Houssin        <regis.houssin@cap-networks.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: llx_fichinterdet.sql,v 1.1 2007/08/28 07:46:40 hregis Exp $
+-- $Source: /cvsroot/dolibarr/dolibarr/mysql/tables/llx_fichinterdet.sql,v $
+-- ===================================================================
+
+create table llx_fichinterdet
+(
+  rowid SERIAL PRIMARY KEY,
+  "fk_fichinter"      integer,
+  "date"              date,              -- date de la ligne d'intervention
+  "description"       text,              -- description de la ligne d'intervention
+  "duree"             integer,           -- duree de la ligne d'intervention
+  "rang"              integer DEFAULT 0  -- ordre affichage sur la fiche
+);
diff --git a/pgsql/tables/llx_osc_categories.sql b/pgsql/tables/llx_osc_categories.sql
index 82ebd0454af..949463833ca 100644
--- a/pgsql/tables/llx_osc_categories.sql
+++ b/pgsql/tables/llx_osc_categories.sql
@@ -2,23 +2,27 @@
 -- (c) 2004, PostgreSQL Inc.
 -- (c) 2005, Laurent Destailleur.
 
--- phpMyAdmin SQL Dump
--- version 2.6.2-Debian-3sarge3
--- http://www.phpmyadmin.net
--- 
--- Serveur: localhost
--- G�n�r� le : Mercredi 20 Juin 2007 � 15:13
--- Version du serveur: 4.0.24
--- Version de PHP: 4.3.10-19
--- 
--- Base de donn�es: `dolidev`
--- 
-
--- --------------------------------------------------------
-
--- 
--- Structure de la table `llx_osc_categories`
--- 
+-- ===================================================================
+-- 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: llx_osc_categories.sql,v 1.3 2007/08/26 19:21:40 eldy Exp $
+-- $Source: /cvsroot/dolibarr/dolibarr/mysql/tables/llx_osc_categories.sql,v $
+--
+-- ===================================================================
 
 CREATE TABLE llx_osc_categories (
   rowid SERIAL PRIMARY KEY,
diff --git a/pgsql/tables/llx_osc_customer.sql b/pgsql/tables/llx_osc_customer.sql
index 23930c3ca97..534964a22f5 100644
--- a/pgsql/tables/llx_osc_customer.sql
+++ b/pgsql/tables/llx_osc_customer.sql
@@ -19,15 +19,17 @@
 -- along with this program; if not, write to the Free Software
 -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 --
--- $Id: llx_osc_customer.sql,v 1.2 2007/06/11 22:52:15 hregis Exp $
+-- $Id: llx_osc_customer.sql,v 1.3 2007/08/26 19:21:40 eldy Exp $
 -- $Source: /cvsroot/dolibarr/dolibarr/mysql/tables/llx_osc_customer.sql,v $
 --
 -- ===================================================================
 
-CREATE TABLE IF NOT EXISTS `llx_osc_customer` (
-  "`rowid`" int4 NOT NULL default '0',
-  "`datem`" timestamp default NULL,
-  "`fk_soc`" int4 NOT NULL default '0',
-  PRIMARY KEY  (`rowid`),
-  "UNIQUE"   UNIQUE  (`fk_soc`)
+CREATE TABLE llx_osc_customer (
+  "rowid" int4 NOT NULL default '0',
+  "datem" timestamp default NULL,
+  "fk_soc" int4 NOT NULL default '0',
+  UNIQUE(fk_soc)
 ) TYPE=InnoDB COMMENT='Table transition client OSC - societe Dolibarr';
+
+CREATE INDEX idx_llx_osc_customer_rowid ON llx_osc_customer (rowid);
+CREATE INDEX fk_soc ON llx_osc_customer (fk_soc);
diff --git a/pgsql/tables/llx_osc_order.sql b/pgsql/tables/llx_osc_order.sql
index 4e299271381..e7f96c759df 100644
--- a/pgsql/tables/llx_osc_order.sql
+++ b/pgsql/tables/llx_osc_order.sql
@@ -19,15 +19,17 @@
 -- along with this program; if not, write to the Free Software
 -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 --
--- $Id: llx_osc_order.sql,v 1.3 2007/06/11 22:52:15 hregis Exp $
+-- $Id: llx_osc_order.sql,v 1.4 2007/08/26 19:21:40 eldy Exp $
 -- $Source: /cvsroot/dolibarr/dolibarr/mysql/tables/llx_osc_order.sql,v $
 --
 -- ===================================================================
 
-CREATE TABLE IF NOT EXISTS `llx_osc_order` (
-  "`rowid`" int4 NOT NULL default '0',
-  "`datem`" timestamp default NULL,
-  "`fk_commande`" int4 NOT NULL default '0',
-  PRIMARY KEY  (`rowid`),
-  "UNIQUE"   UNIQUE  (`fk_commande`)
+CREATE TABLE llx_osc_order (
+  "rowid" int4 NOT NULL default '0',
+  "datem" timestamp default NULL,
+  "fk_commande" int4 NOT NULL default '0',
+  UNIQUE(fk_commande)
 ) TYPE=InnoDB COMMENT='Table transition commande OSC - commande Dolibarr';
+
+CREATE INDEX idx_llx_osc_order_rowid ON llx_osc_order (rowid);
+CREATE INDEX fk_commande ON llx_osc_order (fk_commande);
diff --git a/pgsql/tables/llx_osc_product.sql b/pgsql/tables/llx_osc_product.sql
index f8a272a48dc..b367997dfd2 100644
--- a/pgsql/tables/llx_osc_product.sql
+++ b/pgsql/tables/llx_osc_product.sql
@@ -19,17 +19,19 @@
 -- along with this program; if not, write to the Free Software
 -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 --
--- $Id: llx_osc_product.sql,v 1.3 2007/06/11 22:52:15 hregis Exp $
+-- $Id: llx_osc_product.sql,v 1.4 2007/08/26 19:21:41 eldy Exp $
 -- $Source: /cvsroot/dolibarr/dolibarr/mysql/tables/llx_osc_product.sql,v $
 --
 -- ===================================================================
 
-CREATE TABLE IF NOT EXISTS `llx_osc_product` (
-  "`rowid`" int4 NOT NULL default '0',
-  "`datem`" timestamp default NULL,
-  "`fk_product`" int4 NOT NULL default '0',
-  PRIMARY KEY  (`rowid`),
-  "UNIQUE"   UNIQUE  (`fk_product`)
+CREATE TABLE llx_osc_product (
+  "rowid" int4 NOT NULL default '0',
+  "datem" timestamp default NULL,
+  "fk_product" int4 NOT NULL default '0',
+  UNIQUE(fk_product)
 ) TYPE=InnoDB COMMENT='Table transition produit OSC - produit Dolibarr';
 
+CREATE INDEX idx_llx_osc_product_rowid ON llx_osc_product (rowid);
+CREATE INDEX fk_product ON llx_osc_product (fk_product);
+
 
diff --git a/pgsql/tables/llx_societe_remise.sql b/pgsql/tables/llx_societe_remise.sql
index 38abb45c5d0..98a6d10315a 100644
--- a/pgsql/tables/llx_societe_remise.sql
+++ b/pgsql/tables/llx_societe_remise.sql
@@ -22,8 +22,7 @@
 -- $Id$
 -- $Source$
 --
--- Historique des remises clients
--- 
+-- Historique evolution de la remise relative des tiers
 -- ========================================================================
 
 
-- 
GitLab