The Migrator class executes migration files - PHP files with MDB2 instructions for database schema changes.
With migrations you have a versioning scheme for database schema changes and you can always go back and forward to a known database schema - on all of your database servers (development, production and test). The currect schema version number is stored in a special table in your database.
Located in /migrator.php (line 28)
Data Source Name
Example for a valid data source: mysql://my_user:my_pass@localhost/mydb
PEAR_Log or similar object
Directory where th migration files are stored
Filenames, sorted by number prefix
Highest number prefix in $migration_files
Table name where the schema versions are stored
Version to up/downgrade to
Initialize the internal variables.
If you subclass Migrator, you must call this constructor!
If the result given is an error, throw an exception.
Collects migration file names from $migrations_dir and stores them in the sorted array $migration_files.
$migration_max_version is set to the biggest migration file prefix number.
Initializes $db with an instance of a MDB2 database driver.
The MDB2 "Manager" module is also loaded for the driver.
Leave only files in $this->migration_files that are needen for up/downgrade.
Initializes $current_version with version number from $schema_version_table.
If the table doesn't exist, initialize with 0 and create the table.
Load each class in $migration_files and call its "up" or "down" method
Return the migration file number at the start of a filename.
The main function that does the migration.
Connects to the database, reads the current schema version, decides to up- or downgrade, loads the matching migrations, executes them and updates the schema version.
Write the new version number into {$schema_version_table}.
Callback function for http://www.php.net/array_filter that returns true for migration files between $target_version and $current_version.
Callback function for http://www.php.net/array_filter that returns true for migration files between $current_version and $target_version.
Documentation generated on Sat, 09 Jun 2007 11:50:10 +0200 by phpDocumentor 1.3.2