diff --git a/build/dolibarr_mysql2pgsql.pl b/build/dolibarr_mysql2pgsql.pl index 230281e278f..3ba5016cc7b 100644 --- a/build/dolibarr_mysql2pgsql.pl +++ b/build/dolibarr_mysql2pgsql.pl @@ -221,28 +221,25 @@ foreach my $file (keys %filelist) { # double -> float8 s/double\([^)]*\)/float8/i; - # add unique to definition of type (MySQL separates this) -# if (/unique \w+ \((\w+)\)/i) { -# $create_sql.=~s/($1)([^,]+)/$1$2 unique/i; -# next; -# } # FIX: unique for multipe columns (col1,col2) are unsupported! -# next if (/unique/i); + # Ignore "unique key(xx, yy)" + next if (/unique key\(\w+\s*,\s*\w+\)/i); if (/\bkey\b/i && !/^\s+primary key\s+/i) { s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i; # hack off name of the non-primary key } - # if key(xxx), - if (/key\((\w+)\)/) { - $create_index .= "CREATE INDEX ${table}_$1 ON $table ($1);\n"; + # if key(xxx) + if (/key\((\w+)\)/i) { + #$create_index .= "CREATE INDEX ${table}_$1 ON $table ($1);\n"; + $create_index .= "CREATE INDEX idx_$1 ON $table ($1);\n"; next; } - # quote column names + # Quote column names s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if (!/\bkey\b/i); - # remap colums with names of existing system attribute + # Remap colums with names of existing system attribute if (/"oid"/i) { s/"oid"/"_oid"/g; print STDERR "WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue."; diff --git a/pgsql/tables/llx_album_to_groupart.sql b/pgsql/tables/llx_album_to_groupart.sql index 1335da8341c..5a84ea6ca64 100644 --- a/pgsql/tables/llx_album_to_groupart.sql +++ b/pgsql/tables/llx_album_to_groupart.sql @@ -28,7 +28,6 @@ create table llx_album_to_groupart ( "fk_album" integer NOT NULL, - "fk_groupart" integer NOT NULL, - unique key(fk_album, fk_groupart) + "fk_groupart" integer NOT NULL ); diff --git a/pgsql/tables/llx_co_fa.sql b/pgsql/tables/llx_co_fa.sql index a34d1610c7a..10b41ba0dec 100644 --- a/pgsql/tables/llx_co_fa.sql +++ b/pgsql/tables/llx_co_fa.sql @@ -31,5 +31,5 @@ create table llx_co_fa "fk_facture" integer NOT NULL ); -CREATE INDEX llx_co_fa_fk_commande ON llx_co_fa (fk_commande); -CREATE INDEX llx_co_fa_fk_facture ON llx_co_fa (fk_facture); +CREATE INDEX idx_fk_commande ON llx_co_fa (fk_commande); +CREATE INDEX idx_fk_facture ON llx_co_fa (fk_facture); diff --git a/pgsql/tables/llx_expedition.sql b/pgsql/tables/llx_expedition.sql index c83632fac2b..e13263e2d80 100644 --- a/pgsql/tables/llx_expedition.sql +++ b/pgsql/tables/llx_expedition.sql @@ -44,5 +44,5 @@ create table llx_expedition "UNIQUE" INDEX (ref) ); -CREATE INDEX llx_expedition_fk_expedition_methode ON llx_expedition (fk_expedition_methode); -CREATE INDEX llx_expedition_fk_commande ON llx_expedition (fk_commande); +CREATE INDEX idx_fk_expedition_methode ON llx_expedition (fk_expedition_methode); +CREATE INDEX idx_fk_commande ON llx_expedition (fk_commande); diff --git a/pgsql/tables/llx_expeditiondet.sql b/pgsql/tables/llx_expeditiondet.sql index 6a9b6096a02..034114bdfcd 100644 --- a/pgsql/tables/llx_expeditiondet.sql +++ b/pgsql/tables/llx_expeditiondet.sql @@ -32,5 +32,5 @@ create table llx_expeditiondet "qty" real, -- quantité ); -CREATE INDEX llx_expeditiondet_fk_expedition ON llx_expeditiondet (fk_expedition); -CREATE INDEX llx_expeditiondet_fk_commande_ligne ON llx_expeditiondet (fk_commande_ligne); +CREATE INDEX idx_fk_expedition ON llx_expeditiondet (fk_expedition); +CREATE INDEX idx_fk_commande_ligne ON llx_expeditiondet (fk_commande_ligne); diff --git a/pgsql/tables/llx_prelevement_lignes.sql b/pgsql/tables/llx_prelevement_lignes.sql new file mode 100644 index 00000000000..910fcbc2382 --- /dev/null +++ b/pgsql/tables/llx_prelevement_lignes.sql @@ -0,0 +1,44 @@ +-- 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_prelevement_lignes +( + rowid SERIAL PRIMARY KEY, + "fk_prelevement_bons" integer, + "fk_soc" integer NOT NULL, + "statut" smallint DEFAULT 0, + "client_nom" varchar(255), + "amount" real DEFAULT 0, + "code_banque" varchar(7), + "code_guichet" varchar(6), + "number" varchar(255), + "cle_rib" varchar(5), + "note" text +); diff --git a/pgsql/tables/llx_product_fournisseur.sql b/pgsql/tables/llx_product_fournisseur.sql index b90469b7c9f..fd024ede4f7 100644 --- a/pgsql/tables/llx_product_fournisseur.sql +++ b/pgsql/tables/llx_product_fournisseur.sql @@ -36,6 +36,6 @@ create table llx_product_fournisseur "fk_user_author" integer ); -CREATE INDEX llx_product_fournisseur_fk_product ON llx_product_fournisseur (fk_product); -CREATE INDEX llx_product_fournisseur_fk_soc ON llx_product_fournisseur (fk_soc); +CREATE INDEX idx_fk_product ON llx_product_fournisseur (fk_product); +CREATE INDEX idx_fk_soc ON llx_product_fournisseur (fk_soc); diff --git a/pgsql/tables/llx_product_stock.sql b/pgsql/tables/llx_product_stock.sql index f511510eb99..4328cfa5368 100644 --- a/pgsql/tables/llx_product_stock.sql +++ b/pgsql/tables/llx_product_stock.sql @@ -34,6 +34,6 @@ create table llx_product_stock "reel" integer, -- stock réel ); -CREATE INDEX llx_product_stock_fk_product ON llx_product_stock (fk_product); -CREATE INDEX llx_product_stock_fk_entrepot ON llx_product_stock (fk_entrepot); +CREATE INDEX idx_fk_product ON llx_product_stock (fk_product); +CREATE INDEX idx_fk_entrepot ON llx_product_stock (fk_entrepot); diff --git a/pgsql/tables/llx_stock_mouvement.sql b/pgsql/tables/llx_stock_mouvement.sql index fb3aeae360b..4a2f950e3b8 100644 --- a/pgsql/tables/llx_stock_mouvement.sql +++ b/pgsql/tables/llx_stock_mouvement.sql @@ -37,6 +37,6 @@ create table llx_stock_mouvement "fk_user_author" integer ); -CREATE INDEX llx_stock_mouvement_fk_product ON llx_stock_mouvement (fk_product); -CREATE INDEX llx_stock_mouvement_fk_entrepot ON llx_stock_mouvement (fk_entrepot); +CREATE INDEX idx_fk_product ON llx_stock_mouvement (fk_product); +CREATE INDEX idx_fk_entrepot ON llx_stock_mouvement (fk_entrepot);