Documentation

MigrationTask extends Task
in package

Task managing database migrations

Table of Contents

generateAction()  : void
Generate a migration checking difference between models and database
mainAction()  : void
Main task action (not implemented)
rollbackAction()  : void
Rollback migration to a specific version or the previous based on env_version
runAction()  : void
Execute migrations not already done based on env_version
createAlter()  : string
Generate alter query according to action
executeQueries()  : void
Execute queries from migration data
getFieldQuery()  : string
Create part of alter table corresponding to the field information

Methods

generateAction()

Generate a migration checking difference between models and database

public generateAction() : void
Return values
void

mainAction()

Main task action (not implemented)

public mainAction() : void
Return values
void

rollbackAction()

Rollback migration to a specific version or the previous based on env_version

public rollbackAction([null|int $version = null ]) : void
Parameters
$version : null|int = null
Return values
void

runAction()

Execute migrations not already done based on env_version

public runAction() : void
Return values
void

createAlter()

Generate alter query according to action

private createAlter(string $table, string $action, string $name[, null|array<string|int, mixed> $field = null ]) : string
Parameters
$table : string

Table name

$action : string

Alter action

$name : string

Field name

$field : null|array<string|int, mixed> = null
Return values
string

Alter query

executeQueries()

Execute queries from migration data

private executeQueries(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

Migration data

Return values
void

getFieldQuery()

Create part of alter table corresponding to the field information

private getFieldQuery(string $name, array<string|int, mixed> $field) : string
Parameters
$name : string

Field name

$field : array<string|int, mixed>

Field informations

Return values
string

Part of the alter table

Search results