osclass/OSClass — Issue #30: DB Update problem
Author: steveh57
Created: 2011-11-16 19:08:06+00:00
State: open

There were a number of reports of db upgrade issues on 2.2.3 and trying to upgrade my db to 2.3RC had a similar problem with lots of error messages. Debugging db.php showed that an erroneous ', ' (comma space or possibly comma tab) was being added to the end of CHANGE COLUMN queries.

Taracque was close to the right answer (see http://forums.osclass.org/index.php/topic,4201.0.html) but another line of code also needs changing. From line 367 in db.php change to:
case 'key':
$indexes[] = trim($field, ", \t\r\n"); //was trim($field, ", \n");
break;
default :

$normal_fields[strtolower($field_name[1])] = trim($field, ", \t\r\n"); //was trim($field, ", \n");
break;
This fixes almost all the problems except for two lines in struct.sql that have single quotes in them and generate the following queries (i.e. quotes have been stripped):
[ALTER TABLE oc_t_locale ALTER COLUMN s_dec_point SET DEFAULT .]

[ALTER TABLE oc_t_locale ALTER COLUMN s_thousands_sep SET DEFAULT ]
(I added the [ ] to clearly show the start and end of the query text).
I've fixed this manually in my db for now but needs a change either to struct.sql or db.php.
Steve.