cleaning up some code.
This commit is contained in:
@@ -35,17 +35,16 @@ class Schema {
|
||||
|
||||
$grammar = static::grammar($connection);
|
||||
|
||||
// Each grammar has a function that corresponds to the command type
|
||||
// and is responsible for building that's commands SQL. This lets
|
||||
// the SQL generation stay very granular and makes it simply to
|
||||
// add new database systems to the schema system.
|
||||
// Each grammar has a function that corresponds to the command type and is for
|
||||
// building that command's SQL. This lets the SQL generation stay granular
|
||||
// and flexible across various database systems.
|
||||
if (method_exists($grammar, $method = $command->type))
|
||||
{
|
||||
$statements = $grammar->$method($table, $command);
|
||||
|
||||
// Once we have the statements, we will cast them to an array
|
||||
// even though not all of the commands return an array just
|
||||
// in case the command needs to run more than one query.
|
||||
// Once we have the statements, we will cast them to an array even though
|
||||
// not all of the commands return an array just in case the command
|
||||
// needs multiple queries to complete its database work.
|
||||
foreach ((array) $statements as $statement)
|
||||
{
|
||||
$connection->statement($statement);
|
||||
@@ -62,10 +61,9 @@ class Schema {
|
||||
*/
|
||||
protected static function implications($table)
|
||||
{
|
||||
// If the developer has specified columns for the table and the
|
||||
// table is not being created, we will assume they simply want
|
||||
// to add the columns to the table, and will generate an add
|
||||
// command on the schema automatically.
|
||||
// If the developer has specified columns for the table and the table is
|
||||
// not being created, we'll assume they simply want to add the columns
|
||||
// to the table and generate the add command.
|
||||
if (count($table->columns) > 0 and ! $table->creating())
|
||||
{
|
||||
$command = new Fluent(array('type' => 'add'));
|
||||
@@ -73,9 +71,9 @@ class Schema {
|
||||
array_unshift($table->commands, $command);
|
||||
}
|
||||
|
||||
// For some extra syntax sugar, we'll check for any implicit
|
||||
// indexes on the table since the developer may specify the
|
||||
// index type on the fluent column declaration.
|
||||
// For some extra syntax sugar, we'll check for any implicit indexes
|
||||
// on the table since the developer may specify the index type on
|
||||
// the fluent column declaration for convenience.
|
||||
foreach ($table->columns as $column)
|
||||
{
|
||||
foreach (array('primary', 'unique', 'fulltext', 'index') as $key)
|
||||
|
||||
Reference in New Issue
Block a user