Пример #1
0
 /**
  * Class init.
  *
  * @param string $name
  * @param int    $length
  * @param bool   $allowNull
  * @param string $default
  * @param string $comment
  * @param array  $options
  */
 public function __construct($name = null, $length = 255, $allowNull = false, $default = null, $comment = '', $options = array())
 {
     $options['length'] = $length;
     parent::__construct($name, DataType::CHAR, Column::SIGNED, $allowNull, $default, $comment, $options);
 }
Пример #2
0
 /**
  * Class init.
  *
  * @param string $name
  * @param string $comment
  * @param array  $options
  */
 public function __construct($name = null, $comment = '', $options = array())
 {
     $options['primary'] = true;
     parent::__construct($name, DataType::INTEGER, Column::UNSIGNED, Column::NOT_NULL, null, $comment, $options);
 }
Пример #3
0
 /**
  * Class init.
  *
  * @param string $name
  * @param bool   $allowNull
  * @param string $default
  * @param string $comment
  * @param array  $options
  */
 public function __construct($name = null, $allowNull = false, $default = null, $comment = '', $options = array())
 {
     parent::__construct($name, DataType::LONGTEXT, Column::SIGNED, $allowNull, $default, $comment, $options);
 }
Пример #4
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;
 }
Пример #5
0
 /**
  * Class init.
  *
  * @param string $name
  * @param string $length
  * @param bool   $signed
  * @param bool   $allowNull
  * @param string $default
  * @param string $comment
  * @param array  $options
  */
 public function __construct($name = null, $length = null, $signed = false, $allowNull = false, $default = null, $comment = '', $options = array())
 {
     $options['length'] = $length;
     parent::__construct($name, DataType::FLOAT, $signed, $allowNull, $default, $comment, $options);
 }
Пример #6
0
 /**
  * Class init.
  *
  * @param string $name
  * @param bool   $allowNull
  * @param string $default
  * @param string $comment
  * @param array  $options
  */
 public function __construct($name = null, $allowNull = false, $default = null, $comment = '', $options = array())
 {
     parent::__construct($name, DataType::DATETIME, true, $allowNull, $default, $comment, $options);
 }