From cc304cdce48b6ea2647dc3cbd7f6b4f6a97effea Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sun, 26 Aug 2007 19:21:40 +0000
Subject: [PATCH] =?UTF-8?q?Fix:=20Corrige=20quelques=20instructions=20SQL?=
 =?UTF-8?q?=20non=20norm=E9es=20qui=20posent=20pb=20dans=20la=20conversion?=
 =?UTF-8?q?=20vers=20pgsql.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 build/dolibarr_mysql2pgsql.pl         |  2 +-
 mysql/migration/2.0.0-2.1.0.sql       |  2 +-
 mysql/migration/2.1.0-2.2.0.sql       |  3 +++
 mysql/tables/llx_bordereau_cheque.sql |  2 +-
 mysql/tables/llx_osc_categories.sql   | 38 +++++++++++++++------------
 mysql/tables/llx_osc_customer.sql     | 12 ++++-----
 mysql/tables/llx_osc_order.sql        | 12 ++++-----
 mysql/tables/llx_osc_product.sql      | 12 ++++-----
 8 files changed, 45 insertions(+), 38 deletions(-)

diff --git a/build/dolibarr_mysql2pgsql.pl b/build/dolibarr_mysql2pgsql.pl
index c2e417c5a9c..a696acfe075 100644
--- a/build/dolibarr_mysql2pgsql.pl
+++ b/build/dolibarr_mysql2pgsql.pl
@@ -170,7 +170,7 @@ foreach my $file (keys %filelist) {
     		} 
 
             # enum -> check
-    		if (/([\w\"]*)\s+enum\s*\(((?:['"]\w+['"]\s*,)+['"]\w+['"])\)(.*)$/i) {
+    		if (/([\w\"]*)\s+enum\s*\(((?:['"][\?\w]+['"]\s*,)+['"][\?\w]+['"])\)(.*)$/i) {
     			$enum_column=$1;
     			$enum_datafield{$enum_column}=$2;  # 'abc','def', ...
     			my $suite=$3;
diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql
index a36ff2e1c68..09c9915b3a4 100644
--- a/mysql/migration/2.0.0-2.1.0.sql
+++ b/mysql/migration/2.0.0-2.1.0.sql
@@ -927,7 +927,7 @@ create table llx_bordereau_cheque
   rowid             integer AUTO_INCREMENT PRIMARY KEY,
   datec             datetime,
   date_bordereau    date,
-  number            mediumint ZEROFILL,
+  number            mediumint,
   amount            float(12,2),
   nbcheque          smallint UNSIGNED DEFAULT 0,
   fk_bank_account   integer,
diff --git a/mysql/migration/2.1.0-2.2.0.sql b/mysql/migration/2.1.0-2.2.0.sql
index 26580ac0e9e..4600d7b4099 100644
--- a/mysql/migration/2.1.0-2.2.0.sql
+++ b/mysql/migration/2.1.0-2.2.0.sql
@@ -820,3 +820,6 @@ update llx_boxes set box_order = concat('A0',box_order) where length(box_order)
 update llx_boxes set box_order = concat('B0',box_order) where length(box_order) = 1 and substring(box_order,-1) in ('0','2','4','6','8');
 update llx_boxes set box_order = concat('A',box_order) where length(box_order) = 2 and substring(box_order,-1) in ('1','3','5','7','9');
 update llx_boxes set box_order = concat('B',box_order) where length(box_order) = 2 and substring(box_order,-1) in ('0','2','4','6','8');
+
+
+alter table llx_bordereau_cheque modify number integer;
diff --git a/mysql/tables/llx_bordereau_cheque.sql b/mysql/tables/llx_bordereau_cheque.sql
index b6c897760fc..f1f3289ad6c 100644
--- a/mysql/tables/llx_bordereau_cheque.sql
+++ b/mysql/tables/llx_bordereau_cheque.sql
@@ -27,7 +27,7 @@ create table llx_bordereau_cheque
   rowid             integer AUTO_INCREMENT PRIMARY KEY,
   datec             datetime,
   date_bordereau    date,
-  number            mediumint ZEROFILL,
+  number            integer,
   amount            float(12,2),
   nbcheque          smallint UNSIGNED DEFAULT 0,
   fk_bank_account   integer,
diff --git a/mysql/tables/llx_osc_categories.sql b/mysql/tables/llx_osc_categories.sql
index d02e02855e7..aeee8062d15 100644
--- a/mysql/tables/llx_osc_categories.sql
+++ b/mysql/tables/llx_osc_categories.sql
@@ -1,20 +1,24 @@
--- 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$
+-- $Source$
+--
+-- ===================================================================
 
 CREATE TABLE llx_osc_categories (
   rowid int(11) unsigned NOT NULL auto_increment,
diff --git a/mysql/tables/llx_osc_customer.sql b/mysql/tables/llx_osc_customer.sql
index 491b7d0f8b6..182d111d81b 100644
--- a/mysql/tables/llx_osc_customer.sql
+++ b/mysql/tables/llx_osc_customer.sql
@@ -20,10 +20,10 @@
 --
 -- ===================================================================
 
-CREATE TABLE IF NOT EXISTS `llx_osc_customer` (
-  `rowid` int(11) NOT NULL default '0',
-  `datem` datetime default NULL,
-  `fk_soc` int(11) NOT NULL default '0',
-  PRIMARY KEY  (`rowid`),
-  UNIQUE KEY `fk_soc` (`fk_soc`)
+CREATE TABLE llx_osc_customer (
+  rowid int(11) NOT NULL default '0',
+  datem datetime default NULL,
+  fk_soc int(11) NOT NULL default '0',
+  PRIMARY KEY  (rowid),
+  UNIQUE KEY fk_soc (fk_soc)
 ) TYPE=InnoDB COMMENT='Table transition client OSC - societe Dolibarr';
diff --git a/mysql/tables/llx_osc_order.sql b/mysql/tables/llx_osc_order.sql
index 14c6a872bc2..5ff171d556c 100644
--- a/mysql/tables/llx_osc_order.sql
+++ b/mysql/tables/llx_osc_order.sql
@@ -20,10 +20,10 @@
 --
 -- ===================================================================
 
-CREATE TABLE IF NOT EXISTS `llx_osc_order` (
-  `rowid` int(11) NOT NULL default '0',
-  `datem` datetime default NULL,
-  `fk_commande` int(11) NOT NULL default '0',
-  PRIMARY KEY  (`rowid`),
-  UNIQUE KEY `fk_commande` (`fk_commande`)
+CREATE TABLE llx_osc_order (
+  rowid int(11) NOT NULL default '0',
+  datem datetime default NULL,
+  fk_commande int(11) NOT NULL default '0',
+  PRIMARY KEY  (rowid),
+  UNIQUE KEY fk_commande (fk_commande)
 ) TYPE=InnoDB COMMENT='Table transition commande OSC - commande Dolibarr';
diff --git a/mysql/tables/llx_osc_product.sql b/mysql/tables/llx_osc_product.sql
index ff10752e515..8c7d8dfa3e6 100644
--- a/mysql/tables/llx_osc_product.sql
+++ b/mysql/tables/llx_osc_product.sql
@@ -20,12 +20,12 @@
 --
 -- ===================================================================
 
-CREATE TABLE IF NOT EXISTS `llx_osc_product` (
-  `rowid` int(11) NOT NULL default '0',
-  `datem` datetime default NULL,
-  `fk_product` int(11) NOT NULL default '0',
-  PRIMARY KEY  (`rowid`),
-  UNIQUE KEY `fk_product` (`fk_product`)
+CREATE TABLE llx_osc_product (
+  rowid int(11) NOT NULL default '0',
+  datem datetime default NULL,
+  fk_product int(11) NOT NULL default '0',
+  PRIMARY KEY  (rowid),
+  UNIQUE KEY fk_product (fk_product)
 ) TYPE=InnoDB COMMENT='Table transition produit OSC - produit Dolibarr';
 
 
-- 
GitLab