2
0
forked from Wavyzz/dolibarr

New: Upgrade process works with Postgresql

This commit is contained in:
Laurent Destailleur
2010-08-11 22:56:13 +00:00
parent 5439973b1e
commit d73635c318
3 changed files with 28 additions and 6 deletions

View File

@@ -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))
{