Skip to content

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

View source

Public Properties ​

PropertyDescription
categoryMaparray – Mapping of abstract column types (keys) to type categories (values).
commentstring – Comment value of the column.
dbyii\db\Connection – The current database connection.
typeCategoryMaparray – Mapping of abstract column types (keys) to type categories (values).

Protected Properties ​

PropertyDescription
afterstring – The column after which this column will be added.
appendmixed – SQL string to be appended to column schema definition.
checkstring – The CHECK constraint for the column.
defaultmixed – Default value of the column.
isFirstboolean – Whether this column is to be inserted at the beginning of the table.
isNotNullboolean, null – Whether the column is or not nullable.
isUniqueboolean – Whether the column values should be unique.
isUnsignedboolean – Whether the column values should be unsigned.
lengthinteger, string, array – Column size or precision definition.
typestring – The column type definition such as INTEGER, VARCHAR, DATETIME, etc.

Public Methods ​

MethodDescription
__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 ​

MethodDescription
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.

View source

Returns ​

string

Constants ​

ConstantDescription
CATEGORY_NUMERIC
CATEGORY_OTHER
CATEGORY_PK
CATEGORY_STRING
CATEGORY_TIME