Copied!

MigrationService

MigrationService.php : 18
Interface

Methods

publicadd()

MigrationService.php : 31

Adds a migration into their storage.

public add(Migration $migration[, string|null $directoryKey = null ]) : void

Parameters

Name Type Default value Description
$migration Migration - -
$directoryKey string|null null

Key (from the migration_directory config option) of the directory to store the migration in, instead of the default one. Only supported when the configured storage is aware of multiple directories.

Tags
Throws
MigrationAlreadyExistsException

if adding migration would cause an existing migration to become overwritten

Throws
UnknownMigrationDirectoryException

if $directoryKey doesn't match a configured directory

publicexecuteAll()

MigrationService.php : 73

Executes all available (present in migration storage) migration that are not yet executed.

public executeAll([string|null $userLogin = null ]) : void

Parameters

Name Type Default value Description
$userLogin string|null null

User login to execute migrations as. I not passed a default one should be used.

Tags
Throws
UnhandledMigrationException

when Migration execution fails.

Throws
InvalidMigrationException

when Migration format is invalid.

Throws
MigrationAlreadyExecutedException

when migration is already present in metadata storage.

publicexecuteOne()

MigrationService.php : 59

Executes a single migration and stores the result in metadata storage.

public executeOne(Migration $migration[, string|null $userLogin = null ]) : void

Parameters

Name Type Default value Description
$migration Migration - -
$userLogin string|null null

User login to execute migrations as. If not passed a default one should be used.

Tags
Throws
UnhandledMigrationException

when Migration execution fails.

Throws
InvalidMigrationException

when Migration format is invalid.

Throws
MigrationAlreadyExecutedException

when migration is already present in metadata storage.

publicfindOneByName()

MigrationService.php : 80

Find a single Migration.

public findOneByName(string $name) : Migration|null

Parameters

Name Type Default value Description
$name string - -

Return values

Migration|null

publicisMigrationExecuted()

MigrationService.php : 47

Checks if Migration is already marked as executed in database.

public isMigrationExecuted(Migration $migration) : bool

Parameters

Name Type Default value Description
$migration Migration - -

Return values

bool

publiclistMigrations()

MigrationService.php : 42

Return Migrations ordered according to the configured MigrationComparator (alphabetically by their names, by default).

public listMigrations() : array<string|int, Migration>

Return values

array<string|int, Migration>