Пример #1
0
 /**
  * addColumn
  *
  * @param string $name
  * @param string $type
  * @param bool   $signed
  * @param bool   $allowNull
  * @param string $default
  * @param string $comment
  * @param array  $options
  *
  * @return  static
  */
 public function addColumn($name, $type = 'text', $signed = true, $allowNull = true, $default = '', $comment = '', $options = array())
 {
     $column = $name;
     if (!$column instanceof Column) {
         $column = new Column($name, $type, $signed, $allowNull, $default, $comment, $options);
     }
     $type = MysqlType::getType($column->getType());
     $length = $column->getLength() ?: MysqlType::getLength($type);
     $column->type($type)->length($length);
     if ($column->isPrimary()) {
         $this->primary[] = $column->getName();
     }
     $this->columns[] = $column;
     return $this;
 }