From d73635c3187ca74ecb418edefa7ae7d42d17480b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Wed, 11 Aug 2010 22:56:13 +0000 Subject: [PATCH] New: Upgrade process works with Postgresql --- ChangeLog | 11 +++++++++++ htdocs/install/mysql/migration/2.9.0-3.0.0.sql | 14 +++++++++----- htdocs/lib/databases/pgsql.lib.php | 9 ++++++++- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b35fe430dd0..a319b574780 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ English Dolibarr ChangeLog +***** ChangeLog for 3.0 compared to 2.9 ***** + +For users: +- New: When sending supplier orders by mail, a text is predefined. +- New: Upgrade process works with Postgresql. + +For developer: +- Qual: Renamed some fields into database to be more internationnal. + + + ***** ChangeLog for 2.9 compared to 2.8 ***** For users: diff --git a/htdocs/install/mysql/migration/2.9.0-3.0.0.sql b/htdocs/install/mysql/migration/2.9.0-3.0.0.sql index d7ee2708b5b..1cd3e3e81b0 100644 --- a/htdocs/install/mysql/migration/2.9.0-3.0.0.sql +++ b/htdocs/install/mysql/migration/2.9.0-3.0.0.sql @@ -5,13 +5,17 @@ -- This file must be loaded by calling /install/index.php page -- when current version is 2.8.0 or higher. -- +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE oldname newname varchar(60); +-- To change type of field: ALTER TABLE llx_table MODIFY name varchar(60); +-- - +-- Add recuperableonly field alter table llx_product add column recuperableonly integer NOT NULL DEFAULT '0' after tva_tx; - alter table llx_product_price add column recuperableonly integer NOT NULL DEFAULT '0' after tva_tx; - -alter table llx_product change column envente tosell smallint DEFAULT 1; -alter table llx_product add column tobuy smallint DEFAULT 1 after tosell; +-- Rename envente into tosell and add tobuy +alter table llx_product change column envente tosell tinyint DEFAULT 1; +alter table llx_product add column tobuy tinyint DEFAULT 1 after tosell; +alter table llx_product_price change column envente tosell tinyint DEFAULT 1; \ No newline at end of file diff --git a/htdocs/lib/databases/pgsql.lib.php b/htdocs/lib/databases/pgsql.lib.php index dd880069b21..ec524a974f0 100644 --- a/htdocs/lib/databases/pgsql.lib.php +++ b/htdocs/lib/databases/pgsql.lib.php @@ -211,7 +211,14 @@ class DoliDb # We remove start of requests "ALTER TABLE tablexxx" if this is a DROP INDEX $line=preg_replace('/ALTER TABLE [a-z0-9_]+ DROP INDEX/i','DROP INDEX',$line); - # alter table add primary key (field1, field2 ...) -> We remove the primary key name not accepted by PostGreSQL + # Translate order to rename fields + if (preg_match('/ALTER TABLE ([a-z0-9_]+) CHANGE COLUMN ([a-z0-9_]+) ([a-z0-9_]+)(.*)$/i',$line,$reg)) + { + $line = "-- ".$line." replaced by --\n"; + $line.= "ALTER TABLE ".$reg[1]." RENAME COLUMN ".$reg[2]." TO ".$reg[3]; + } + + # alter table add primary key (field1, field2 ...) -> We remove the primary key name not accepted by PostGreSQL # ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity); if (preg_match('/ALTER\s+TABLE\s*(.*)\s*ADD\s+PRIMARY\s+KEY\s*(.*)\s*\((.*)$/i',$line,$reg)) { -- GitLab