CreatePhpSessionTable

Type
Class
Namespace
craft\migrations
Inherits
craft\migrations\CreatePhpSessionTable » craft\db\Migration » yii\db\Migration (opens new window) » yii\base\Component (opens new window) » yii\base\BaseObject (opens new window)
Implements
yii\base\Configurable (opens new window), yii\db\MigrationInterface (opens new window)
Uses traits
yii\db\SchemaBuilderTrait (opens new window)
Since
3.4.0

CreatePhpSessionTable Migration

View source (opens new window)

# Public Properties

Property Description
behaviors (opens new window) yii\base\Behavior (opens new window) – List of behaviors attached to this component.
compact (opens new window) boolean (opens new window) – Indicates whether the console output should be compacted.
db craft\db\Connection – the DB connection that this command is associated with
maxSqlOutputLength (opens new window) integer (opens new window) – Max number of characters of the SQL outputted.

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__clone() (opens new window) This method is called after the object is created by cloning an existing one.
__construct() (opens new window) Constructor.
__get() (opens new window) Returns the value of a component property.
__isset() (opens new window) Checks if a property is set, i.e. defined and not null.
__set() (opens new window) Sets the value of a component property.
__unset() (opens new window) Sets a component property to be null.
addColumn() (opens new window) Builds and executes a SQL statement for adding a new DB column.
addCommentOnColumn() (opens new window) Builds and execute a SQL statement for adding comment to column.
addCommentOnTable() (opens new window) Builds a SQL statement for adding comment to table.
addForeignKey() Builds a SQL statement for adding a foreign key constraint to an existing table.
addPrimaryKey() Builds and executes a SQL statement for creating a primary key.
alterColumn() (opens new window) Builds and executes a SQL statement for changing the definition of a column.
attachBehavior() (opens new window) Attaches a behavior to this component.
attachBehaviors() (opens new window) Attaches a list of behaviors to the component.
batchInsert() Creates and executes a batch INSERT SQL statement.
behaviors() (opens new window) Returns a list of behaviors that this component should behave as.
bigInteger() (opens new window) Creates a bigint column.
bigPrimaryKey() (opens new window) Creates a big primary key column.
binary() (opens new window) Creates a binary column.
boolean() (opens new window) Creates a boolean column.
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.
char() (opens new window) Creates a char column.
className() (opens new window) Returns the fully qualified name of this class.
createIndex() Builds and executes a SQL statement for creating a new index.
createIndexIfMissing() Creates a new index if a similar one doesn’t already exist.
createTable() (opens new window) Builds and executes a SQL statement for creating a new DB table.
date() (opens new window) Creates a date column.
dateTime() (opens new window) Creates a datetime column.
decimal() (opens new window) Creates a decimal column.
delete() (opens new window) Creates and executes a DELETE SQL statement.
deleteDuplicates() Creates and executes a DELETE SQL statement that will only delete duplicate rows from a table.
detachBehavior() (opens new window) Detaches a behavior from the component.
detachBehaviors() (opens new window) Detaches all behaviors from the component.
double() (opens new window) Creates a double column.
down() This method contains the logic to be executed when removing this migration.
dropColumn() (opens new window) Builds and executes a SQL statement for dropping a DB column.
dropCommentFromColumn() (opens new window) Builds and execute a SQL statement for dropping comment from column.
dropCommentFromTable() (opens new window) Builds a SQL statement for dropping comment from table.
dropForeignKey() (opens new window) Builds a SQL statement for dropping a foreign key constraint.
dropForeignKeyIfExists() Builds and executes a SQL statement for dropping a foreign key, if it exists.
dropIndex() (opens new window) Builds and executes a SQL statement for dropping an index.
dropIndexIfExists() Builds and executes a SQL statement for dropping an index, if it exists.
dropPrimaryKey() (opens new window) Builds and executes a SQL statement for dropping a primary key.
dropTable() (opens new window) Builds and executes a SQL statement for dropping a DB table.
dropTableIfExists() Creates and executes a SQL statement for dropping a DB table, if it exists.
ensureBehaviors() (opens new window) Makes sure that the behaviors declared in behaviors() (opens new window) are attached to this component.
enum() Creates an enum column for MySQL and PostgreSQL, or a string column with a check constraint for others.
execute() (opens new window) Executes a SQL statement.
float() (opens new window) Creates a float column.
getBehavior() (opens new window) Returns the named behavior object.
getBehaviors() (opens new window) Returns all behaviors attached to this component.
hasEventHandlers() (opens new window) Returns a value indicating whether there is any handler attached to the named event.
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 for this component.
init() (opens new window) Initializes the migration.
insert() Creates and executes an INSERT SQL statement.
integer() (opens new window) Creates an integer column.
json() (opens new window) Creates a JSON column.
longText() Creates a longtext column for MySQL, or text column for others.
mediumText() Creates a mediumtext column for MySQL, or text column for others.
money() (opens new window) Creates a money column.
off() (opens new window) Detaches an existing event handler from this component.
on() (opens new window) Attaches an event handler to an event.
primaryKey() (opens new window) Creates a primary key column.
renameColumn() (opens new window) Builds and executes a SQL statement for renaming a column.
renameSequence() Creates and executes a SQL statement for renaming a DB sequence.
renameTable() (opens new window) Builds and executes a SQL statement for renaming a DB table.
replace() Creates and executes a SQL statement for replacing some text with other text in a given table column.
restore() Creates and executes a SQL statement for restoring a soft-deleted row.
safeDown() This method contains the logic to be executed when removing this migration.
safeUp() This method contains the logic to be executed when applying this migration.
smallInteger() (opens new window) Creates a smallint column.
softDelete() Creates and executes a SQL statement for soft-deleting a row.
string() (opens new window) Creates a string column.
text() (opens new window) Creates a text column.
time() (opens new window) Creates a time column.
timestamp() (opens new window) Creates a timestamp column.
tinyInteger() (opens new window) Creates a tinyint column. If tinyint is not supported by the DBMS, smallint will be used.
tinyText() Creates a tinytext column for MySQL, or text column for others.
trigger() (opens new window) Triggers an event.
truncateTable() (opens new window) Builds and executes a SQL statement for truncating a DB table.
uid() Shortcut for creating a uid column
up() This method contains the logic to be executed when applying this migration.
update() Creates and executes an UPDATE SQL statement.
upsert() Creates and executes a command to insert rows into a database table if they do not already exist (matching unique constraints), or update them if they do.

# safeDown()

This method contains the logic to be executed when removing this migration.

This method differs from down() in that the DB logic implemented here will be enclosed within a DB transaction. Child classes may implement this method instead of down() if the DB logic needs to be within a transaction.

Note: Not all DBMS support transactions. And some DB queries cannot be put into a transaction. For some examples, please refer to implicit commit (opens new window).

View source (opens new window)

Returns

false (opens new window), void, mixed – Return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.

# safeUp()

This method contains the logic to be executed when applying this migration.

This method differs from up() in that the DB logic implemented here will be enclosed within a DB transaction. Child classes may implement this method instead of up() if the DB logic needs to be within a transaction.

Note: Not all DBMS support transactions. And some DB queries cannot be put into a transaction. For some examples, please refer to implicit commit (opens new window).

View source (opens new window)

Returns

false (opens new window), void, mixed – Return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.

# Protected Methods

Method Description
beginCommand() (opens new window) Prepares for a command to be executed, and outputs to the console.
endCommand() (opens new window) Finalizes after the command has been executed, and outputs to the console the time elapsed.
getDb() (opens new window)