Property | Type | Description | |
---|---|---|---|
$categoryMap | mapping of abstract column types (keys) to type categories (values). | ||
$comment | comment value of the column. | ||
$db | the current database connection. It is used mainly to escape strings safely when building the final column schema string. |
Property | Type | Description | |
---|---|---|---|
$after | the column after which this column will be added. | ||
$append | SQL string to be appended to column schema definition. | ||
$check | the CHECK constraint for the column. | ||
$default | default value of the column. | ||
$isFirst | whether this column is to be inserted at the beginning of the table. | ||
$isNotNull | whether the column is or not nullable. If this is true, a NOT NULL constraint will be added. If this is false, a NULL constraint will be added. | ||
$isUnique | whether the column values should be unique. If this is true, a UNIQUE constraint will be added. | ||
$isUnsigned | whether the column values should be unsigned. If this is true, an UNSIGNED keyword will be added. | ||
$length | column size or precision definition. This is what goes into the parenthesis after the column type. This can be either a string, an integer or an array. If it is an array, the array values will be joined into a string separated by comma. | ||
$type | the column type definition such as INTEGER, VARCHAR, DATETIME, etc. |
Method | Description | |
---|---|---|
__construct ( string $type, integer | string | array $length = null, |
Create a column schema builder instance giving the type and value precision. | |
__toString ( ) : string | Builds the full string for the column's schema | |
after ( string $after ) | Adds an AFTER constraint to the column. | |
append ( string $sql ) | Specify additional SQL to be appended to schema string. | |
check ( string $check ) | Sets a CHECK constraint for the column. | |
comment ( string $comment ) | Specifies the comment for column. | |
defaultExpression ( string $default ) | Specify the default SQL expression for the column. | |
defaultValue ( mixed $default ) | Specify the default value for the column. | |
first ( ) | Adds an FIRST constraint to the column. | |
notNull ( ) | Adds a NOT NULL constraint to the column. | |
null ( ) | Adds a NULL constraint to the column | |
unique ( ) | Adds a UNIQUE constraint to the column. | |
unsigned ( ) | Marks column as unsigned. |
Method | Description | |
---|---|---|
buildAfterString ( ) : string | Builds the after constraint for the column. Defaults to unsupported. | |
buildAppendString ( ) : string | Builds the custom string that's appended to column definition. | |
buildCheckString ( ) : string | Builds the check constraint for the column. | |
buildCommentString ( ) : string | Builds the comment specification for the column. | |
buildCompleteString ( string $format ) : string | Returns the complete column definition from input format | |
buildDefaultString ( ) : string | Builds the default value specification for the column. | |
buildFirstString ( ) : string | Builds the first constraint for the column. Defaults to unsupported. | |
buildLengthString ( ) : string | Builds the length/precision part of the column. | |
buildNotNullString ( ) : string | Builds the not null constraint for the column. | |
buildUniqueString ( ) : string | Builds the unique constraint for the column. | |
buildUnsignedString ( ) : string | Builds the unsigned string for column. Defaults to unsupported. | |
getTypeCategory ( ) : string | Returns the category of the column type. |
public __construct ( string $type, integer | string | array $length = null, |
||
$type | string | type of the column. See [[$type]]. |
$length | integer | string | array | length or precision of the column. See [[$length]]. |
$db | the current database connection. See [[$db]]. | |
$config | array | name-value pairs that will be used to initialize the object properties |
public __toString ( ) : string | ||
return | string |
protected buildAfterString ( ) : string | ||
return | string | a string containing the AFTER constraint. |
protected buildAppendString ( ) : string | ||
return | string | custom string to append. |
protected buildCheckString ( ) : string | ||
return | string | a string containing the CHECK constraint. |
protected buildCommentString ( ) : string | ||
return | string | a string containing the COMMENT keyword and the comment itself |
protected buildCompleteString ( string $format ) : string | ||
$format | string | the format of the definition. |
return | string | a string containing the complete column definition. |
protected buildDefaultString ( ) : string | ||
return | string | string with default value of column. |
protected buildFirstString ( ) : string | ||
return | string | a string containing the FIRST constraint. |
protected buildLengthString ( ) : string | ||
return | string |
protected buildNotNullString ( ) : string | ||
return | string | returns 'NOT NULL' if [[isNotNull]] is true, 'NULL' if [[isNotNull]] is false or an empty string otherwise. |
protected buildUniqueString ( ) : string | ||
return | string | returns string 'UNIQUE' if [[isUnique]] is true, otherwise it returns an empty string. |
protected buildUnsignedString ( ) : string | ||
return | string | a string containing UNSIGNED keyword. |
public defaultExpression ( string $default ) | ||
$default | string | the default value expression. |
public defaultValue ( mixed $default ) | ||
$default | mixed | the default value. |
protected getTypeCategory ( ) : string | ||
return | string | a string containing the column type category name. |
public $categoryMap |
public $db |
protected $isFirst |
protected $isNotNull |
protected $isUnique |
protected $isUnsigned |
protected $length |