abstract class Migration

Supports database migration operations.

Properties

protected DB $_db

Database instance.

protected array<string,string> $_columnTypesMap

Maps column types to blueprint methods.

Methods

__construct()

Creates instance of Migration class.

void
aclSetup(string $table)

Setup acl table's initial fields during first db migration.

static int
getNextBatch()

Get value for batch field for next set of migrations.

void
down()

Rollback the migration.

schema(string $table)

Returns a new Blueprint instance for the specified table.

void
up()

Execute the migration.

Details

at line 35
__construct()

Creates instance of Migration class.

at line 46
void aclSetup(string $table)

Setup acl table's initial fields during first db migration.

Parameters

string $table

Name of acl table used to test that we are performing operations on correct table.

Return Value

void

at line 58
static int getNextBatch()

Get value for batch field for next set of migrations.

Return Value

int

Value for batch field to be used in next migration run.

at line 67
abstract void down()

Rollback the migration.

Return Value

void

at line 79
protected Blueprint schema(string $table)

Returns a new Blueprint instance for the specified table.

This method is used to define or modify the structure of a database table. It provides an entry point to schema-building methods such as id(), string(), timestamps(), etc.

Parameters

string $table

The name of the table to build or modify.

Return Value

Blueprint

An instance of the Blueprint class tied to the given table.

at line 86
abstract void up()

Execute the migration.

Return Value

void