abstract class AbstractMigration (View source)

Abstract class for individual migrations to extend from.

Properties

protected Version $version Reference to the Version instance representing this migration
protected Connection $connection The Doctrine\DBAL\Connection instance we are migrating
protected AbstractSchemaManager $sm Reference to the SchemaManager instance referenced by $_connection
protected AbstractPlatform $platform Reference to the DatabasePlatform instance referenced by $_connection

Methods

__construct(Version $version)

No description

bool
isTransactional()

Indicates the transactional mode of this migration.

string
getDescription()

Get migration description

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

Print a warning message if the condition evaluates to TRUE.

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

Abort the migration if the condition evaluates to TRUE.

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

Skip this migration (but not the next ones) if condition evaluates to TRUE.

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($sql, array $params = [], array $types = [])

No description

write($message)

No description

throwIrreversibleMigrationException($message = null)

No description

Details

__construct(Version $version)

Parameters

Version $version

bool 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

Return Value

bool TRUE by default.

string getDescription()

Get migration description

Return Value

string

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

Print a warning message if the condition evaluates to TRUE.

Parameters

boolean $condition
string $message

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

Abort the migration if the condition evaluates to TRUE.

Parameters

boolean $condition
string $message

Exceptions

AbortMigrationException

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

Skip this migration (but not the next ones) if condition evaluates to TRUE.

Parameters

boolean $condition
string $message

Exceptions

SkipMigrationException

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($sql, array $params = [], array $types = [])

Parameters

$sql
array $params
array $types

protected write($message)

Parameters

$message

protected throwIrreversibleMigrationException($message = null)

Parameters

$message