Commit ebcae547 authored by Taylor Otwell's avatar Taylor Otwell

Merge pull request #370 from cviebrock/develop

Add unsigned() modifier, so you can create unsigned integer columns.
parents 30d69ef5 b7d068f2
...@@ -39,4 +39,19 @@ abstract class Grammar extends \Laravel\Database\Grammar { ...@@ -39,4 +39,19 @@ abstract class Grammar extends \Laravel\Database\Grammar {
return parent::wrap($value); return parent::wrap($value);
} }
/**
* 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';
}
}
} }
\ No newline at end of file
...@@ -77,7 +77,7 @@ class MySQL extends Grammar { ...@@ -77,7 +77,7 @@ class MySQL extends Grammar {
// 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)
{ {
......
...@@ -65,7 +65,7 @@ class Postgres extends Grammar { ...@@ -65,7 +65,7 @@ class Postgres extends Grammar {
// 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)
{ {
......
...@@ -91,7 +91,7 @@ class SQLite extends Grammar { ...@@ -91,7 +91,7 @@ class SQLite extends Grammar {
// 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)
{ {
......
...@@ -72,7 +72,7 @@ class SQLServer extends Grammar { ...@@ -72,7 +72,7 @@ class SQLServer extends Grammar {
// 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)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment