ColumnSchemaBuilder

Type
Class
Namespace
craft\db\mysql
Inherits
craft\db\mysql\ColumnSchemaBuilder » yii\db\mysql\ColumnSchemaBuilder (opens new window) » yii\db\ColumnSchemaBuilder (opens new window) » yii\base\BaseObject (opens new window)
Implements
yii\base\Configurable (opens new window)
Since
3.0.0

View source (opens new window)

# Public Properties

Property Description
categoryMap (opens new window) array (opens new window) – Mapping of abstract column types (keys) to type categories (values).
comment (opens new window) string (opens new window) – Comment value of the column.
db (opens new window) yii\db\Connection (opens new window) – The current database connection.

# Protected Properties

Property Description
after (opens new window) string (opens new window) – The column after which this column will be added.
append (opens new window) mixed – SQL string to be appended to column schema definition.
check (opens new window) string (opens new window) – The CHECK constraint for the column.
default (opens new window) mixed – Default value of the column.
isFirst (opens new window) boolean (opens new window) – Whether this column is to be inserted at the beginning of the table.
isNotNull (opens new window) boolean (opens new window), null (opens new window) – Whether the column is or not nullable.
isUnique (opens new window) boolean (opens new window) – Whether the column values should be unique.
isUnsigned (opens new window) boolean (opens new window) – Whether the column values should be unsigned.
length (opens new window) integer (opens new window), string (opens new window), array (opens new window) – Column size or precision definition.
type (opens new window) string (opens new window) – The column type definition such as INTEGER, VARCHAR, DATETIME, etc.

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__construct() (opens new window) Create a column schema builder instance giving the type and value precision.
__get() (opens new window) Returns the value of an object property.
__isset() (opens new window) Checks if a property is set, i.e. defined and not null.
__set() (opens new window) Sets value of an object property.
__toString() (opens new window) Builds the full string for the column's schema.
__unset() (opens new window) Sets an object property to null.
after() (opens new window) Adds an AFTER constraint to the column.
append() (opens new window) Specify additional SQL to be appended to column definition.
canGetProperty() (opens new window) Returns a value indicating whether a property can be read.
canSetProperty() (opens new window) Returns a value indicating whether a property can be set.
check() (opens new window) Sets a CHECK constraint for the column.
className() (opens new window) Returns the fully qualified name of this class.
comment() (opens new window) Specifies the comment for column.
defaultExpression() (opens new window) Specify the default SQL expression for the column.
defaultValue() (opens new window) Specify the default value for the column.
first() (opens new window) Adds an FIRST constraint to the column.
hasMethod() (opens new window) Returns a value indicating whether a method is defined.
hasProperty() (opens new window) Returns a value indicating whether a property is defined.
init() Initializes the object.
notNull() (opens new window) Adds a NOT NULL constraint to the column.
null() (opens new window) Adds a NULL constraint to the column.
unique() (opens new window) Adds a UNIQUE constraint to the column.
unsigned() (opens new window) Marks column as unsigned.

# init()

Initializes the object.

This method is invoked at the end of the constructor after the object is initialized with the given configuration.

View source (opens new window)

# Protected Methods

Method Description
buildAfterString() (opens new window) Builds the after constraint for the column. Defaults to unsupported.
buildAppendString() (opens new window) Builds the custom string that's appended to column definition.
buildCheckString() (opens new window) Builds the check constraint for the column.
buildCommentString() (opens new window) Builds the comment specification for the column.
buildCompleteString() (opens new window) Returns the complete column definition from input format.
buildDefaultString() (opens new window) Builds the default value specification for the column.
buildFirstString() (opens new window) Builds the first constraint for the column. Defaults to unsupported.
buildLengthString() Builds the length/precision part of the column.
buildNotNullString() (opens new window) Builds the not null constraint for the column.
buildUniqueString() (opens new window) Builds the unique constraint for the column.
buildUnsignedString() (opens new window) Builds the unsigned string for column. Defaults to unsupported.
getTypeCategory() (opens new window) Returns the category of the column type.

# buildLengthString()

Builds the length/precision part of the column.

View source (opens new window)

Returns

string (opens new window)

# Constants

Constant Description
CATEGORY_NUMERIC
CATEGORY_OTHER
CATEGORY_PK
CATEGORY_STRING
CATEGORY_TIME