Back to PostgresqlChangeItem class

Method fixInteger

private string
fixInteger
(mixed $type1, mixed $type2)
Fix up integer. Fixes problem with PostgreSQL integer descriptions.
Parameters
  • string $type1 the column type
  • string $type2 the column attributes
Returns
  • string The original or changed column type.
Since
  • 3.0

Method fixInteger - Source code

/**
 * Fix up integer. Fixes problem with PostgreSQL integer descriptions.
 * If you change a column to "integer unsigned" it shows
 * as "int(10) unsigned" in the check query.
 *
 * @param   string  $type1  the column type
 * @param   string  $type2  the column attributes
 *
 * @return  string  The original or changed column type.
 *
 * @since   3.0
 */
private function fixInteger($type1, $type2)
{
    $result = $type1;
    if (strtolower($type1) === 'integer' && strtolower(substr($type2, 0, 8)) === 'unsigned') {
        $result = 'unsigned int(10)';
    }
    return $result;
}