abstract class AbstractMigration (View source)

The AbstractMigration class is for end users to extend from when creating migrations. Extend this class and implement the required up() and down() methods.

Properties

protected Version $version
protected Connection $connection
protected AbstractSchemaManager $sm
protected AbstractPlatform $platform

Methods

__construct(Version $version)

No description

isTransactional()

Indicates the transactional mode of this migration.

getDescription()

No description

warnIf(bool $condition, string $message = '')

No description

abortIf(bool $condition, string $message = '')

No description

skipIf(bool $condition, string $message = '')

No description

preUp(Schema $schema)

No description

postUp(Schema $schema)

No description

preDown(Schema $schema)

No description

postDown(Schema $schema)

No description

up(Schema $schema)

No description

down(Schema $schema)

No description

addSql(string $sql, array $params = [], array $types = [])

No description

write(string $message)

No description

throwIrreversibleMigrationException(string|null $message = null)

No description

Details

__construct(Version $version)

Parameters

Version $version

isTransactional()

Indicates the transactional mode of this migration.

If this function returns true (default) the migration will be executed in one transaction, otherwise non-transactional state will be used to execute each of the migration SQLs.

Extending class should override this function to alter the return value.

getDescription()

warnIf(bool $condition, string $message = '')

Parameters

bool $condition
string $message

abortIf(bool $condition, string $message = '')

Parameters

bool $condition
string $message

Exceptions

AbortMigration

skipIf(bool $condition, string $message = '')

Parameters

bool $condition
string $message

Exceptions

SkipMigration

preUp(Schema $schema)

Parameters

Schema $schema

postUp(Schema $schema)

Parameters

Schema $schema

preDown(Schema $schema)

Parameters

Schema $schema

postDown(Schema $schema)

Parameters

Schema $schema

abstract up(Schema $schema)

Parameters

Schema $schema

abstract down(Schema $schema)

Parameters

Schema $schema

protected addSql(string $sql, array $params = [], array $types = [])

Parameters

string $sql
array $params
array $types

protected write(string $message)

Parameters

string $message

protected throwIrreversibleMigrationException(string|null $message = null)

Parameters

string|null $message