\Omega\Database\Migration MysqlMigration

Mysql migration class.

The MysqlMigration class handles SQLite database migrations, creating or altering tables.

Summary

Methods
Properties
Constants
__construct
execute
down
stringForField
dropColumn
bool
dateTime
float
id
int
string
text
fields
table
type
drops
No public constants found
No protected methods found
connection
No protected constants found
No private methods found
No private properties found
No private constants found

Properties

$fields

$fields : \Omega\Database\Migration\Field\AbstractField[]

Fields array.

Type

array<string|int, AbstractField> — Holds an array of fields.

$table

$table : string

Table name.

Type

string — Holds the table name.

$type

$type : string

Query type.

Type

string — Holds the query type-

$drops

$drops : string[]

Drops columns.

Type

array<string|int, string> — Holds an array of drops columns.

Methods

__construct()

__construct(\Omega\Database\Adapter\DatabaseAdapterInterface  $connection, string  $table, string  $type) : void

MysqlMigration class constructor.

Parameters

\Omega\Database\Adapter\DatabaseAdapterInterface $connection

Holds an instance of Mysql.

string $table

Holds the table name.

string $type

Holds the query type.

Returns

void —

execute()

execute() : void

Execute migration.

Returns

void —

down()

down() : void

Rolls back the migration (drops the table).

return void

Returns

void —

stringForField()

stringForField(\Omega\Database\Migration\Field\AbstractField  $field) : string

String for field.

Parameters

\Omega\Database\Migration\Field\AbstractField $field

Holds an instance of AbstractField.

Returns

string —

Return the string for the field.

dropColumn()

dropColumn(string  $name) : $this

Drop column.

Parameters

string $name

Holds the column name.

Returns

$this —

bool()

bool(string  $name) : \Omega\Database\Migration\Field\BoolField

Set boolean field.

Parameters

string $name

Holds the field name.

Returns

\Omega\Database\Migration\Field\BoolField —

Return an instance of BoolField.

dateTime()

dateTime(string  $name) : \Omega\Database\Migration\Field\DateTimeField

Set date time field.

Parameters

string $name

Holds the field name.

Returns

\Omega\Database\Migration\Field\DateTimeField —

Return an instance of DateTimeField.

float()

float(string  $name) : \Omega\Database\Migration\Field\FloatField

Set float field.

Parameters

string $name

Holds the field name.

Returns

\Omega\Database\Migration\Field\FloatField —

Return an instance of FloatField.

id()

id(string  $name) : \Omega\Database\Migration\Field\IdField

Set id field.

Parameters

string $name

Holds the field name.

Returns

\Omega\Database\Migration\Field\IdField —

Return an instance of IdField.

int()

int(string  $name) : \Omega\Database\Migration\Field\IntField

Set int field.

Parameters

string $name

Holds the field name.

Returns

\Omega\Database\Migration\Field\IntField —

Return an instance of IntField.

string()

string(string  $name) : \Omega\Database\Migration\Field\StringField

Set string field.

Parameters

string $name

Holds the field name.

Returns

\Omega\Database\Migration\Field\StringField —

Return an instance of StringField.

text()

text(string  $name) : \Omega\Database\Migration\Field\TextField

Set text field.

Parameters

string $name

Holds the field name.

Returns

\Omega\Database\Migration\Field\TextField —

Return an instance of TextField.