Example #1
0
 /**
  * Add any implicit commands to the schema table operation.
  *
  * @param   Schema\Table  $table
  * @return  void
  */
 protected static function implications($table)
 {
     // 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'));
         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 convenience.
     foreach ($table->columns as $column) {
         foreach (array('primary', 'unique', 'fulltext', 'index') as $key) {
             if (isset($column->attributes[$key])) {
                 $table->{$key}($column->name);
             }
         }
     }
 }