ColumnSchemaBuilder ​
- Type
- Class
- Namespace
- craft\db\mysql
- Inherits
- craft\db\mysql\ColumnSchemaBuilder » yii\db\mysql\ColumnSchemaBuilder » yii\db\ColumnSchemaBuilder » yii\base\BaseObject
- Implements
- yii\base\Configurable
- Since
- 3.0.0
Public Properties ​
Property | Description |
---|---|
categoryMap | array – Mapping of abstract column types (keys) to type categories (values). |
comment | string – Comment value of the column. |
db | yii\db\Connection – The current database connection. |
typeCategoryMap | array – Mapping of abstract column types (keys) to type categories (values). |
Protected Properties ​
Property | Description |
---|---|
after | string – The column after which this column will be added. |
append | mixed – SQL string to be appended to column schema definition. |
check | string – The CHECK constraint for the column. |
default | mixed – Default value of the column. |
isFirst | boolean – Whether this column is to be inserted at the beginning of the table. |
isNotNull | boolean, null – Whether the column is or not nullable. |
isUnique | boolean – Whether the column values should be unique. |
isUnsigned | boolean – Whether the column values should be unsigned. |
length | integer, string, array – Column size or precision definition. |
type | string – The column type definition such as INTEGER, VARCHAR, DATETIME, etc. |
Public Methods ​
Method | Description |
---|---|
__call() | Calls the named method which is not a class method. |
__construct() | Create a column schema builder instance giving the type and value precision. |
__get() | Returns the value of an object property. |
__isset() | Checks if a property is set, i.e. defined and not null. |
__set() | Sets value of an object property. |
__toString() | Builds the full string for the column's schema. |
__unset() | Sets an object property to null. |
after() | Adds an AFTER constraint to the column. |
append() | Specify additional SQL to be appended to column definition. |
canGetProperty() | Returns a value indicating whether a property can be read. |
canSetProperty() | Returns a value indicating whether a property can be set. |
check() | Sets a CHECK constraint for the column. |
className() | Returns the fully qualified name of this class. |
comment() | Specifies the comment for column. |
defaultExpression() | Specify the default SQL expression for the column. |
defaultValue() | Specify the default value for the column. |
first() | Adds an FIRST constraint to the column. |
getCategoryMap() | |
hasMethod() | Returns a value indicating whether a method is defined. |
hasProperty() | Returns a value indicating whether a property is defined. |
init() | Initializes the object. |
notNull() | Adds a NOT NULL constraint to the column. |
null() | Adds a NULL constraint to the column. |
setCategoryMap() | |
unique() | Adds a UNIQUE constraint to the column. |
unsigned() | Marks column as unsigned. |
Protected Methods ​
Method | Description |
---|---|
buildAfterString() | Builds the after constraint for the column. Defaults to unsupported. |
buildAppendString() | Builds the custom string that's appended to column definition. |
buildCheckString() | Builds the check constraint for the column. |
buildCommentString() | Builds the comment specification for the column. |
buildCompleteString() | Returns the complete column definition from input format. |
buildDefaultString() | Builds the default value specification for the column. |
buildDefaultValue() | Return the default value for the column. |
buildFirstString() | Builds the first constraint for the column. Defaults to unsupported. |
buildLengthString() | Builds the length/precision part of the column. |
buildNotNullString() | Builds the not null constraint for the column. |
buildUniqueString() | Builds the unique constraint for the column. |
buildUnsignedString() | Builds the unsigned string for column. Defaults to unsupported. |
getTypeCategory() | Returns the category of the column type. |
buildLengthString()
​
Builds the length/precision part of the column.
Returns ​
Constants ​
Constant | Description |
---|---|
CATEGORY_NUMERIC | |
CATEGORY_OTHER | |
CATEGORY_PK | |
CATEGORY_STRING | |
CATEGORY_TIME |