Add unsigned() modifier, so you can create unsigned integer columns
This commit is contained in:
parent
30d69ef548
commit
26c7273493
|
@ -77,7 +77,7 @@ protected function columns(Table $table)
|
||||||
// types to the correct types.
|
// types to the correct types.
|
||||||
$sql = $this->wrap($column).' '.$this->type($column);
|
$sql = $this->wrap($column).' '.$this->type($column);
|
||||||
|
|
||||||
$elements = array('nullable', 'defaults', 'incrementer');
|
$elements = array('unsigned', 'nullable', 'defaults', 'incrementer');
|
||||||
|
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element)
|
||||||
{
|
{
|
||||||
|
@ -90,6 +90,21 @@ protected function columns(Table $table)
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the SQL syntax for indicating if a column is unsigned.
|
||||||
|
*
|
||||||
|
* @param Table $table
|
||||||
|
* @param Fluent $column
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function unsigned(Table $table, Fluent $column)
|
||||||
|
{
|
||||||
|
if ($column->type == 'integer' && $column->unsigned)
|
||||||
|
{
|
||||||
|
return ' UNSIGNED';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the SQL syntax for indicating if a column is nullable.
|
* Get the SQL syntax for indicating if a column is nullable.
|
||||||
*
|
*
|
||||||
|
|
|
@ -65,7 +65,7 @@ protected function columns(Table $table)
|
||||||
// types to the types used by the database.
|
// types to the types used by the database.
|
||||||
$sql = $this->wrap($column).' '.$this->type($column);
|
$sql = $this->wrap($column).' '.$this->type($column);
|
||||||
|
|
||||||
$elements = array('incrementer', 'nullable', 'defaults');
|
$elements = array('unsigned', 'incrementer', 'nullable', 'defaults');
|
||||||
|
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element)
|
||||||
{
|
{
|
||||||
|
@ -78,6 +78,21 @@ protected function columns(Table $table)
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the SQL syntax for indicating if a column is unsigned.
|
||||||
|
*
|
||||||
|
* @param Table $table
|
||||||
|
* @param Fluent $column
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function unsigned(Table $table, Fluent $column)
|
||||||
|
{
|
||||||
|
if ($column->type == 'integer' && $column->unsigned)
|
||||||
|
{
|
||||||
|
return ' UNSIGNED';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the SQL syntax for indicating if a column is nullable.
|
* Get the SQL syntax for indicating if a column is nullable.
|
||||||
*
|
*
|
||||||
|
|
|
@ -91,7 +91,7 @@ protected function columns(Table $table)
|
||||||
// types to the types used by the database.
|
// types to the types used by the database.
|
||||||
$sql = $this->wrap($column).' '.$this->type($column);
|
$sql = $this->wrap($column).' '.$this->type($column);
|
||||||
|
|
||||||
$elements = array('nullable', 'defaults', 'incrementer');
|
$elements = array('unsigned', 'nullable', 'defaults', 'incrementer');
|
||||||
|
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element)
|
||||||
{
|
{
|
||||||
|
@ -104,6 +104,21 @@ protected function columns(Table $table)
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the SQL syntax for indicating if a column is unsigned.
|
||||||
|
*
|
||||||
|
* @param Table $table
|
||||||
|
* @param Fluent $column
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function unsigned(Table $table, Fluent $column)
|
||||||
|
{
|
||||||
|
if ($column->type == 'integer' && $column->unsigned)
|
||||||
|
{
|
||||||
|
return ' UNSIGNED';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the SQL syntax for indicating if a column is nullable.
|
* Get the SQL syntax for indicating if a column is nullable.
|
||||||
*
|
*
|
||||||
|
|
|
@ -72,7 +72,7 @@ protected function columns(Table $table)
|
||||||
// types to the types used by the database.
|
// types to the types used by the database.
|
||||||
$sql = $this->wrap($column).' '.$this->type($column);
|
$sql = $this->wrap($column).' '.$this->type($column);
|
||||||
|
|
||||||
$elements = array('incrementer', 'nullable', 'defaults');
|
$elements = array('unsigned', 'incrementer', 'nullable', 'defaults');
|
||||||
|
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element)
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,21 @@ protected function columns(Table $table)
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the SQL syntax for indicating if a column is unsigned.
|
||||||
|
*
|
||||||
|
* @param Table $table
|
||||||
|
* @param Fluent $column
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function unsigned(Table $table, Fluent $column)
|
||||||
|
{
|
||||||
|
if ($column->type == 'integer' && $column->unsigned)
|
||||||
|
{
|
||||||
|
return ' UNSIGNED';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the SQL syntax for indicating if a column is nullable.
|
* Get the SQL syntax for indicating if a column is nullable.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue