Fix detection of auto_increment fields in MySQL (sets them as 'serial' type)

This commit is contained in:
Brion Vibber 2010-10-07 17:22:36 -07:00
parent 3c979ec506
commit 85156fcbed

View File

@ -134,12 +134,15 @@ class MysqlSchema extends Schema
$field['description'] = $row['COLUMN_COMMENT'];
}
// $row['EXTRA'] may contain 'autoincrement'
// ^ type=serial?
// $row['EXTRA'] may contain 'on update CURRENT_TIMESTAMP'
// ^ ...... how to specify?
// these seem to be the only values in curent use
$extra = $row['EXTRA'];
if ($extra) {
if (preg_match('/(^|\s)auto_increment(\s|$)/i', $extra)) {
$field['type'] = 'serial';
}
// $row['EXTRA'] may contain 'on update CURRENT_TIMESTAMP'
// ^ ...... how to specify?
}
if ($row['CHARACTER_SET_NAME'] !== null) {
// @fixme check against defaults?
//$def['charset'] = $row['CHARACTER_SET_NAME'];