Documentation

Migrator
in package

Tags
author

Mike Naberezny mike@maintainable.com

author

Derek DeVries derek@maintainable.com

author

Chuck Hagenbuch chuck@horde.org

category

Horde

copyright

2007 Maintainable Software, LLC

copyright

2006-2021 Horde LLC

license

http://www.horde.org/licenses/bsd

subpackage

Migration

Table of Contents

$connection  : Adapter
$direction  : string
$inflector  : mixed
$logger  : Horde_Log_Logger|null
$migrationsPath  : string
$schemaTableName  : string
$targetVersion  : int
__construct()  : mixed
Constructor.
down()  : mixed
getCurrentVersion()  : int
getTargetVersion()  : int
migrate()  : mixed
setInflector()  : mixed
setLogger()  : mixed
setMigrationsPath()  : mixed
up()  : mixed
assertUniqueMigrationVersion()  : mixed
doMigrate()  : mixed
Performs the migration.
getMigrationClass()  : Base
Actually returns object, and not class.
getMigrationClasses()  : array<string|int, mixed>
getMigrationFiles()  : array<string|int, mixed>
Returns the list of migration files.
getMigrationVersionAndName()  : array<string|int, mixed>
hasReachedTargetVersion()  : bool
initializeSchemaInformation()  : mixed
isDown()  : bool
isIrrelevantMigration()  : bool
isUp()  : bool
setSchemaVersion()  : mixed

Properties

$direction

protected string $direction = null

$logger

protected Horde_Log_Logger|null $logger

$migrationsPath

protected string $migrationsPath = null

$schemaTableName

protected string $schemaTableName = 'schema_info'

$targetVersion

protected int $targetVersion = null

Methods

__construct()

Constructor.

public __construct(Adapter $connection[, Horde_Log_Logger $logger = null ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$connection : Adapter

A DB connection object.

$logger : Horde_Log_Logger = null

A logger object.

$options : array<string|int, mixed> = []

Additional options for the migrator:

  • migrationsPath: directory with the migration files.
  • schemaTableName: table for storing the schema version.
Tags
throws
MigrationException
Return values
mixed

down()

public down([string $targetVersion = null ]) : mixed
Parameters
$targetVersion : string = null
Return values
mixed

getCurrentVersion()

public getCurrentVersion() : int
Return values
int

getTargetVersion()

public getTargetVersion() : int
Return values
int

migrate()

public migrate([string $targetVersion = null ]) : mixed
Parameters
$targetVersion : string = null
Return values
mixed

setInflector()

public setInflector(Horde_Support_Inflector $inflector) : mixed
Parameters
$inflector : Horde_Support_Inflector
Return values
mixed

setLogger()

public setLogger(Horde_Log_Logger $logger) : mixed
Parameters
$logger : Horde_Log_Logger
Return values
mixed

setMigrationsPath()

public setMigrationsPath(string $migrationsPath) : mixed
Parameters
$migrationsPath : string

Path to migration files.

Return values
mixed

up()

public up([string $targetVersion = null ]) : mixed
Parameters
$targetVersion : string = null
Return values
mixed

assertUniqueMigrationVersion()

protected assertUniqueMigrationVersion(array<string|int, mixed> $migrations, int $version) : mixed
Parameters
$migrations : array<string|int, mixed>
$version : int
Tags
throws
MigrationException
Return values
mixed

doMigrate()

Performs the migration.

protected doMigrate() : mixed
Return values
mixed

getMigrationClass()

Actually returns object, and not class.

protected getMigrationClass(string $migrationName, int $version) : Base
Parameters
$migrationName : string
$version : int
Return values
Base

getMigrationClasses()

protected getMigrationClasses() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMigrationFiles()

Returns the list of migration files.

protected getMigrationFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMigrationVersionAndName()

protected getMigrationVersionAndName(string $migrationFile) : array<string|int, mixed>
Parameters
$migrationFile : string
Return values
array<string|int, mixed>

($version, $name)

hasReachedTargetVersion()

protected hasReachedTargetVersion(mixed $version) : bool
Parameters
$version : mixed
Return values
bool

initializeSchemaInformation()

protected initializeSchemaInformation() : mixed
Tags
TODO
Return values
mixed

isDown()

protected isDown() : bool
Return values
bool

isIrrelevantMigration()

protected isIrrelevantMigration(int $version) : bool
Parameters
$version : int
Return values
bool

isUp()

protected isUp() : bool
Return values
bool

setSchemaVersion()

protected setSchemaVersion(int $version) : mixed
Parameters
$version : int
Return values
mixed

Search results