// Parse out the field type and meta information.
preg_match('@([a-z]+)(?:\((\d+)(?:,(\d+))?\))?\s*(unsigned)?@',
$row['Type'
],
$matches);
$type =
$this->
fieldTypeMap($connection,
$matches[1
]);
if ($row['Extra'
] === 'auto_increment'
) { // If this is an auto increment, then the type is 'serial'.
$type = 'serial';
} $definition['fields'
][$name] =
[ 'type' =>
$type,
'not null' =>
$row['Null'
] === 'NO',
];
if ($size =
$this->
fieldSizeMap($connection,
$matches[1
])) { $definition['fields'
][$name]['size'
] =
$size;
} if (isset($matches[2
]) &&
$type === 'numeric'
) { // Add precision and scale.
$definition['fields'
][$name]['precision'
] =
$matches[2
];
$definition['fields'
][$name]['scale'
] =
$matches[3
];
} elseif ($type === 'time'
) { // @todo Core doesn't support these, but copied from `migrate-db.sh` for now.
// Convert to varchar.
$definition['fields'
][$name]['type'
] = 'varchar';