Added support for decimal data type in schema.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
This commit is contained in:
@@ -337,6 +337,17 @@ class MySQL extends Grammar {
|
|||||||
return 'FLOAT';
|
return 'FLOAT';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the data-type definintion for a decimal.
|
||||||
|
*
|
||||||
|
* @param Fluent $column
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function type_decimal(Fluent $column)
|
||||||
|
{
|
||||||
|
return "DECIMAL({$column->precision}, {$column->scale})";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the data-type definition for a boolean.
|
* Generate the data-type definition for a boolean.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -338,6 +338,17 @@ class Postgres extends Grammar {
|
|||||||
return 'REAL';
|
return 'REAL';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the data-type definintion for a decimal.
|
||||||
|
*
|
||||||
|
* @param Fluent $column
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function type_decimal(Fluent $column)
|
||||||
|
{
|
||||||
|
return "DECIMAL({$column->precision}, {$column->scale})";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the data-type definition for a boolean.
|
* Generate the data-type definition for a boolean.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -282,6 +282,17 @@ class SQLite extends Grammar {
|
|||||||
return 'FLOAT';
|
return 'FLOAT';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the data-type definintion for a decimal.
|
||||||
|
*
|
||||||
|
* @param Fluent $column
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function type_decimal(Fluent $column)
|
||||||
|
{
|
||||||
|
return 'FLOAT';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the data-type definition for a boolean.
|
* Generate the data-type definition for a boolean.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -356,6 +356,17 @@ class SQLServer extends Grammar {
|
|||||||
return 'FLOAT';
|
return 'FLOAT';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the data-type definintion for a decimal.
|
||||||
|
*
|
||||||
|
* @param Fluent $column
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function type_decimal(Fluent $column)
|
||||||
|
{
|
||||||
|
return "DECIMAL({$column->precision}, {$column->scale})";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the data-type definition for a boolean.
|
* Generate the data-type definition for a boolean.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -276,6 +276,19 @@ class Table {
|
|||||||
return $this->column(__FUNCTION__, compact('name'));
|
return $this->column(__FUNCTION__, compact('name'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a decimal column to the table.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param int $precision
|
||||||
|
* @param int $scale
|
||||||
|
* @return Fluent
|
||||||
|
*/
|
||||||
|
public function decimal($name, $precision, $scale)
|
||||||
|
{
|
||||||
|
return $this->column(__FUNCTION__, compact('name', 'precision', 'scale'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a boolean column to the table.
|
* Add a boolean column to the table.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user