class Configuration (View source)

Constants

VERSIONS_ORGANIZATION_BY_YEAR

VERSIONS_ORGANIZATION_BY_YEAR_AND_MONTH

VERSION_FORMAT

Methods

__construct(Connection $connection, OutputWriter|null $outputWriter = null, MigrationFinder|null $finder = null, QueryWriter|null $queryWriter = null)

No description

areMigrationsOrganizedByYear()

No description

validate()

No description

setName(string $name)

No description

getName()

No description

setOutputWriter(OutputWriter $outputWriter)

No description

getOutputWriter()

No description

getDateTime(string $version)

No description

getConnection()

No description

setMigrationsTableName(string $tableName)

No description

getMigrationsTableName()

No description

setMigrationsColumnName(string $columnName)

No description

getMigrationsColumnName()

No description

setMigrationsDirectory(string $migrationsDirectory)

No description

getMigrationsDirectory()

No description

setMigrationsNamespace(string $migrationsNamespace)

No description

getMigrationsNamespace()

No description

setCustomTemplate(string|null $customTemplate)

No description

getCustomTemplate()

No description

setMigrationsFinder(MigrationFinder $finder)

No description

registerMigrationsFromDirectory(string $path)

No description

registerMigration(string $version, string $class)

No description

registerMigrations(array $migrations)

No description

getMigrations()

No description

getVersion(string $version)

No description

hasVersion(string $version)

No description

hasVersionMigrated(Version $version)

No description

string[]
getMigratedVersions()

No description

string[]
getAvailableVersions()

No description

getCurrentVersion()

No description

getPrevVersion()

No description

getNextVersion()

No description

getRelativeVersion(string $version, int $delta)

No description

getDeltaVersion(string $delta)

No description

resolveVersionAlias(string $alias)

Returns the version number from an alias.

getLatestVersion()

No description

createMigrationTable()

No description

getMigrationsToExecute(string $direction, string $to)

No description

dispatchEvent(string $eventName, EventArgs|null $args = null)

No description

string[]
findMigrations(string $path)

No description

setMigrationsAreOrganizedByYear(bool $migrationsAreOrganizedByYear = true)

No description

setMigrationsAreOrganizedByYearAndMonth(bool $migrationsAreOrganizedByYearAndMonth = true)

No description

generateVersionNumber(DateTimeInterface|null $now = null)

No description

connect()

Explicitely opens the database connection. This is done to play nice with DBAL's MasterSlaveConnection. Which, in some cases, connects to a follower when fetching the executed migrations. If a follower is lagging significantly behind that means the migrations system may see unexecuted migrations that were actually executed earlier.

getQueryWriter()

No description

setIsDryRun(bool $isDryRun)

No description

Details

__construct(Connection $connection, OutputWriter|null $outputWriter = null, MigrationFinder|null $finder = null, QueryWriter|null $queryWriter = null)

Parameters

Connection $connection
OutputWriter|null $outputWriter
MigrationFinder|null $finder
QueryWriter|null $queryWriter

areMigrationsOrganizedByYear()

areMigrationsOrganizedByYearAndMonth()

validate()

Exceptions

MigrationException

setName(string $name)

Parameters

string $name

getName()

setOutputWriter(OutputWriter $outputWriter)

Parameters

OutputWriter $outputWriter

getOutputWriter()

getDateTime(string $version)

Parameters

string $version

getConnection()

setMigrationsTableName(string $tableName)

Parameters

string $tableName

getMigrationsTableName()

setMigrationsColumnName(string $columnName)

Parameters

string $columnName

getMigrationsColumnName()

getQuotedMigrationsColumnName()

setMigrationsDirectory(string $migrationsDirectory)

Parameters

string $migrationsDirectory

getMigrationsDirectory()

setMigrationsNamespace(string $migrationsNamespace)

Parameters

string $migrationsNamespace

getMigrationsNamespace()

setCustomTemplate(string|null $customTemplate)

Parameters

string|null $customTemplate

getCustomTemplate()

setMigrationsFinder(MigrationFinder $finder)

Parameters

MigrationFinder $finder

Exceptions

MigrationException

Version[] registerMigrationsFromDirectory(string $path)

Parameters

string $path

Return Value

Version[]

registerMigration(string $version, string $class)

Parameters

string $version
string $class

Exceptions

MigrationException

Version[] registerMigrations(array $migrations)

Parameters

array $migrations

Return Value

Version[]

Version[] getMigrations()

Return Value

Version[]

getVersion(string $version)

Parameters

string $version

hasVersion(string $version)

Parameters

string $version

hasVersionMigrated(Version $version)

Parameters

Version $version

string[] getMigratedVersions()

Return Value

string[]

string[] getAvailableVersions()

Return Value

string[]

getCurrentVersion()

getPrevVersion()

getNextVersion()

getRelativeVersion(string $version, int $delta)

Parameters

string $version
int $delta

getDeltaVersion(string $delta)

Parameters

string $delta

resolveVersionAlias(string $alias)

Returns the version number from an alias.

Supported aliases are:

  • first: The very first version before any migrations have been run.
  • current: The current version.
  • prev: The version prior to the current version.
  • next: The version following the current version.
  • latest: The latest available version.

If an existing version number is specified, it is returned verbatimly.

Parameters

string $alias

getNumberOfExecutedMigrations()

getNumberOfAvailableMigrations()

getLatestVersion()

createMigrationTable()

Version[] getMigrationsToExecute(string $direction, string $to)

Parameters

string $direction
string $to

Return Value

Version[]

dispatchEvent(string $eventName, EventArgs|null $args = null)

Parameters

string $eventName
EventArgs|null $args

protected string[] findMigrations(string $path)

Parameters

string $path

Return Value

string[]

setMigrationsAreOrganizedByYear(bool $migrationsAreOrganizedByYear = true)

Parameters

bool $migrationsAreOrganizedByYear

Exceptions

MigrationException

setMigrationsAreOrganizedByYearAndMonth(bool $migrationsAreOrganizedByYearAndMonth = true)

Parameters

bool $migrationsAreOrganizedByYearAndMonth

Exceptions

MigrationException

generateVersionNumber(DateTimeInterface|null $now = null)

Parameters

DateTimeInterface|null $now

protected connect()

Explicitely opens the database connection. This is done to play nice with DBAL's MasterSlaveConnection. Which, in some cases, connects to a follower when fetching the executed migrations. If a follower is lagging significantly behind that means the migrations system may see unexecuted migrations that were actually executed earlier.

getQueryWriter()

setIsDryRun(bool $isDryRun)

Parameters

bool $isDryRun