cleaning up some code.
This commit is contained in:
@@ -23,14 +23,14 @@ class MySQL extends Grammar {
|
||||
{
|
||||
$columns = implode(', ', $this->columns($table));
|
||||
|
||||
// First we will generate the base table creation statement. Other than incrementing
|
||||
// keys, no indexes will be created during the first creation of the table since
|
||||
// they will be added in separate commands.
|
||||
// First we will generate the base table creation statement. Other than auto
|
||||
// incrementing keys, no indexes will be created during the first creation
|
||||
// of the table as they're added in separate commands.
|
||||
$sql = 'CREATE TABLE '.$this->wrap($table).' ('.$columns.')';
|
||||
|
||||
// MySQL supports various "engines" for database tables. If an engine ws specified
|
||||
// by the developer, we will set it after adding the columns the table creation
|
||||
// statement. Some engines support extra indexes.
|
||||
// MySQL supports various "engines" for database tables. If an engine was
|
||||
// specified by the developer, we will set it after adding the columns
|
||||
// the table creation statement the schema.
|
||||
if ( ! is_null($table->engine))
|
||||
{
|
||||
$sql .= ' ENGINE = '.$table->engine;
|
||||
@@ -50,9 +50,9 @@ class MySQL extends Grammar {
|
||||
{
|
||||
$columns = $this->columns($table);
|
||||
|
||||
// Once we the array of column definitions, we need to add "add" to the front
|
||||
// of each definition, then we'll concatenate the definitions using commas
|
||||
// like normal and generate the SQL.
|
||||
// Once we the array of column definitions, we need to add "add" to the
|
||||
// front of each definition, then we'll concatenate the definitions
|
||||
// using commas like normal and generate the SQL.
|
||||
$columns = implode(', ', array_map(function($column)
|
||||
{
|
||||
return 'ADD '.$column;
|
||||
|
||||
@@ -16,9 +16,9 @@ class Postgres extends Grammar {
|
||||
{
|
||||
$columns = implode(', ', $this->columns($table));
|
||||
|
||||
// First we will generate the base table creation statement. Other than incrementing
|
||||
// keys, no indexes will be created during the first creation of the table since
|
||||
// they will be added in separate commands.
|
||||
// First we will generate the base table creation statement. Other than auto
|
||||
// incrementing keys, no indexes will be created during the first creation
|
||||
// of the table as they're added in separate commands.
|
||||
$sql = 'CREATE TABLE '.$this->wrap($table).' ('.$columns.')';
|
||||
|
||||
return $sql;
|
||||
@@ -35,9 +35,9 @@ class Postgres extends Grammar {
|
||||
{
|
||||
$columns = $this->columns($table);
|
||||
|
||||
// Once we the array of column definitions, we need to add "add" to the front
|
||||
// of each definition, then we'll concatenate the definitions using commas
|
||||
// like normal and generate the SQL.
|
||||
// Once we the array of column definitions, we need to add "add" to the
|
||||
// front of each definition, then we'll concatenate the definitions
|
||||
// using commas like normal and generate the SQL.
|
||||
$columns = implode(', ', array_map(function($column)
|
||||
{
|
||||
return 'ADD COLUMN '.$column;
|
||||
|
||||
@@ -53,18 +53,18 @@ class SQLite extends Grammar {
|
||||
{
|
||||
$columns = $this->columns($table);
|
||||
|
||||
// Once we the array of column definitions, we need to add "add" to the front
|
||||
// of each definition, then we'll concatenate the definitions using commas
|
||||
// like normal and generate the SQL.
|
||||
// Once we the array of column definitions, we need to add "add" to the
|
||||
// front of each definition, then we'll concatenate the definitions
|
||||
// using commas like normal and generate the SQL.
|
||||
$columns = array_map(function($column)
|
||||
{
|
||||
return 'ADD COLUMN '.$column;
|
||||
|
||||
}, $columns);
|
||||
|
||||
// SQLite only allows one column to be added in an ALTER statement, so we
|
||||
// will create an array of statements and return them all to the schema
|
||||
// manager, which will execute each one separately.
|
||||
// SQLite only allows one column to be added in an ALTER statement,
|
||||
// so we will create an array of statements and return them all to
|
||||
// the schema manager for separate execution.
|
||||
foreach ($columns as $column)
|
||||
{
|
||||
$sql[] = 'ALTER TABLE '.$this->wrap($table).' '.$column;
|
||||
|
||||
@@ -23,9 +23,9 @@ class SQLServer extends Grammar {
|
||||
{
|
||||
$columns = implode(', ', $this->columns($table));
|
||||
|
||||
// First we will generate the base table creation statement. Other than incrementing
|
||||
// keys, no indexes will be created during the first creation of the table since
|
||||
// they will be added in separate commands.
|
||||
// First we will generate the base table creation statement. Other than auto
|
||||
// incrementing keys, no indexes will be created during the first creation
|
||||
// of the table as they're added in separate commands.
|
||||
$sql = 'CREATE TABLE '.$this->wrap($table).' ('.$columns.')';
|
||||
|
||||
return $sql;
|
||||
@@ -42,9 +42,9 @@ class SQLServer extends Grammar {
|
||||
{
|
||||
$columns = $this->columns($table);
|
||||
|
||||
// Once we the array of column definitions, we need to add "add" to the front
|
||||
// of each definition, then we'll concatenate the definitions using commas
|
||||
// like normal and generate the SQL.
|
||||
// Once we the array of column definitions, we need to add "add" to the
|
||||
// front of each definition, then we'll concatenate the definitions
|
||||
// using commas like normal and generate the SQL.
|
||||
$columns = implode(', ', array_map(function($column)
|
||||
{
|
||||
return 'ADD '.$column;
|
||||
|
||||
Reference in New Issue
Block a user