Skip to content

CreatePhpSessionTable ​

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

CreatePhpSessionTable Migration

View source

Public Properties ​

PropertyDescription
behaviorsyii\base\Behavior – List of behaviors attached to this component.
compactboolean – Indicates whether the console output should be compacted.
dbcraft\db\Connection – the DB connection that this command is associated with
maxSqlOutputLengthinteger – Max number of characters of the SQL outputted.

Public Methods ​

MethodDescription
__call()Calls the named method which is not a class method.
__clone()This method is called after the object is created by cloning an existing one.
__construct()Constructor.
__get()Returns the value of a component property.
__isset()Checks if a property is set, i.e. defined and not null.
__set()Sets the value of a component property.
__unset()Sets a component property to be null.
addCheck()Creates a SQL command for adding a check constraint to an existing table.
addColumn()Builds and executes a SQL statement for adding a new DB column.
addCommentOnColumn()Builds and execute a SQL statement for adding comment to column.
addCommentOnTable()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()Builds and executes a SQL statement for changing the definition of a column.
archiveTableIfExists()Creates and executes a SQL statement for renaming a DB table to *_old, if it exists.
attachBehavior()Attaches a behavior to this component.
attachBehaviors()Attaches a list of behaviors to the component.
batchInsert()Creates and executes a batch INSERT SQL statement.
behaviors()Returns a list of behaviors that this component should behave as.
bigInteger()Creates a bigint column.
bigPrimaryKey()Creates a big primary key column.
binary()Creates a binary column.
boolean()Creates a boolean column.
canGetProperty()Returns a value indicating whether a property can be read.
canSetProperty()Returns a value indicating whether a property can be set.
char()Creates a char column.
className()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()Builds and executes a SQL statement for creating a new DB table.
date()Creates a date column.
dateTime()Creates a datetime column.
decimal()Creates a decimal column.
delete()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()Detaches a behavior from the component.
detachBehaviors()Detaches all behaviors from the component.
double()Creates a double column.
down()This method contains the logic to be executed when removing this migration.
dropAllForeignKeysToTable()Creates and executes a SQL statement for dropping all foreign keys to a table.
dropCheck()Creates a SQL command for dropping a check constraint.
dropColumn()Builds and executes a SQL statement for dropping a DB column.
dropCommentFromColumn()Builds and execute a SQL statement for dropping comment from column.
dropCommentFromTable()Builds a SQL statement for dropping comment from table.
dropForeignKey()Builds a SQL statement for dropping a foreign key constraint.
dropForeignKeyIfExists()Creates and executes a SQL statement for dropping a foreign key if it exists.
dropIndex()Builds and executes a SQL statement for dropping an index.
dropIndexIfExists()Creates and executes a SQL statement for dropping an index if it exists.
dropPrimaryKey()Builds and executes a SQL statement for dropping a primary key.
dropTable()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()Makes sure that the behaviors declared in behaviors() 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()Executes a SQL statement.
float()Creates a float column.
getBehavior()Returns the named behavior object.
getBehaviors()Returns all behaviors attached to this component.
getDb()returns the connection the DB connection that this command is associated with
hasEventHandlers()Returns a value indicating whether there is any handler attached to the named event.
hasMethod()Returns a value indicating whether a method is defined.
hasProperty()Returns a value indicating whether a property is defined for this component.
init()Initializes the migration.
insert()Creates and executes an INSERT SQL statement.
integer()Creates an integer column.
json()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()Creates a money column.
off()Detaches an existing event handler from this component.
on()Attaches an event handler to an event.
primaryKey()Creates a primary key column.
renameColumn()Builds and executes a SQL statement for renaming a column.
renameSequence()Creates and executes a SQL statement for renaming a DB sequence.
renameTable()Builds and executes a SQL statement for renaming a DB table and its corresponding sequence (if PostgreSQL).
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()Creates a smallint column.
softDelete()Creates and executes a SQL statement for soft-deleting a row.
string()Creates a string column.
text()Creates a text column.
time()Creates a time column.
timestamp()Creates a timestamp column.
tinyInteger()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()Triggers an event.
truncateTable()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.

View source

Returns ​

false, 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.

View source

Returns ​

false, 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 ​

MethodDescription
afterDown()This method contains the logic to be executed after removing this migration.
afterUp()This method contains the logic to be executed after applying this migration.
beginCommand()Prepares for a command to be executed, and outputs to the console.
endCommand()Finalizes after the command has been executed, and outputs to the console the time elapsed.