Stud.IP  2.0 Revision 48548
 All Data Structures Namespaces Files Functions Variables Pages
Migrator Class Reference
Collaboration diagram for Migrator:
Collaboration graph

Public Member Functions

 Migrator ($migrations_path, $version, $verbose=FALSE)
 assert_unique_migration_version ($migrations, $version)
 migrate_to ($target_version)
 relevant_migrations ($target_version)
 relevant_migration ($version)
 is_up ()
 is_down ()
 migration_class ($migration)
 migration_classes ()
 migration_files ()
 migration_version_and_name ($migration_file)
 top_version ()
 log ($format)

Data Fields

 $direction
 $migrations_path
 $target_version
 $verbose
 $schema_version

Member Function Documentation

assert_unique_migration_version (   $migrations,
  $version 
)

Sanity check to prevent doublettes.

private

Parameters
arrayan array of migration classes
intthe index of a migration
Returns
void

Here is the caller graph for this function:

is_down ( )

Am I migrating down?

private

Returns
bool TRUE if migrating down, FALSE otherwise

Here is the caller graph for this function:

is_up ( )

Am I migrating up?

private

Returns
bool TRUE if migrating up, FALSE otherwise

Here is the caller graph for this function:

log (   $format)

Overridable method used to return a textual representation of what's going on in me. You can use me as you would use printf.

protected

Parameters
stringjust a dummy value, instead use this method as you would use printf & co.
Returns
void

Here is the caller graph for this function:

migrate_to (   $target_version)

Invoking this method will perform the migrations with an index between the current schema version (provided by the SchemaVersion object) and a target version calling the methods #up and #down in sequence.

Parameters
mixedthe target version as an integer or NULL thus migrating to the top migration
Returns
void

Here is the call graph for this function:

migration_class (   $migration)

Maps a file name to a class name.

protected

Parameters
stringpart of the file name
Returns
string the derived class name

Here is the caller graph for this function:

migration_classes ( )

Returns the collection (an array) of all migrations in this migrator's path.

Returns
array an associative array, whose keys are the migration's version and whose values are arrays containing the migration's file and class name.

Here is the call graph for this function:

Here is the caller graph for this function:

migration_files ( )

Return all migration file names from my migrations_path.

protected

Returns
array a collection of file names

Here is the caller graph for this function:

migration_version_and_name (   $migration_file)

Split a migration file name into that migration's version and name.

protected

Parameters
stringa file name
Returns
array an array of two elements containing the migration's version and name.

Here is the caller graph for this function:

Migrator (   $migrations_path,
  $version,
  $verbose = FALSE 
)

Constructor.

Parameters
stringa file path to the directory containing the migration files
SchemaVersionthe current schema version persistor
booleanverbose or not
Returns
void
relevant_migration (   $version)

Checks wheter a migration has to be invoked, that is if the migration's version is included in the interval between current and target schema version.

private

Parameters
intthe migration's version to check for inclusion
Returns
bool TRUE if included, FALSE otherwise

Here is the call graph for this function:

Here is the caller graph for this function:

relevant_migrations (   $target_version)

Invoking this method will return a list of migrations with an index between the current schema version (provided by the SchemaVersion object) and a target version calling the methods #up and #down in sequence.

Parameters
mixedthe target version as an integer or NULL thus migrating to the top migration
Returns
array an associative array, whose keys are the migration's version and whose values are the migration objects

Here is the call graph for this function:

Here is the caller graph for this function:

top_version ( )

Returns the top migration's version.

Returns
int the top migration's version.

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

$direction
$migrations_path
$schema_version
$target_version
$verbose

The documentation for this class was generated from the following file: