- class Omeka_Db_Migration_Manager¶
Manages database migrations (both upgrades and downgrades).
- constant MIGRATION_TABLE_NAME¶
Name of the migrations table.
- constant MIGRATION_DATE_FORMAT¶
Formatting string to convert dates into YYYYMMDDHHMMSS pattern.
- constant ORIG_MIGRATION_OPTION_NAME¶
Name of the original database option storing the integer migration number.
- constant VERSION_OPTION_NAME¶
Name of the new database option storing the core software version number.
- property _db¶
- property _migrationsDir¶
Directory where migrations scripts are kept.
- __construct(Omeka_Db $db, string $migrationsDir)¶
- $db (Omeka_Db) –
- $migrationsDir (string) –
Set up Omeka to use timestamped database migrations.
This creates the ‘schema_migrations’ table, drops the ‘migration’ optionand adds the ‘omeka_version’ option to the database.
Mark all of the migrations as having been run. Used by the installer as a way of indicating that the database is entirely up to date.
- migrate(string $endTimestamp)¶
Migrate the database schema.
- $endTimestamp (string) – (optional) Timestamp corresponding to the stop point for the migration. If older than the current time, database will migrate down to that point. If newer, the opposite. Defaults to the current timestamp.
Determine whether or not it is possible to migrate the Omeka database up.
This is based entirely on whether there exist any migrations that havenot yet been applied.
Determine whether the database must be upgraded.
In order to return true, this requires that canUprade() == true, and also that Omeka’s code has recently been upgraded.
Finalize the database upgrade by setting the most up-to-date version of Omeka.
- getDefault(Omeka_Db|null $db)¶
Return the default configuration of the database migration manager.
- $db (Omeka_Db|null) –
Retrieve all the versions that have been migrated.
Return the name of the table associated with schema migrations.
Return a list of migration files in the migration directory.
Returns: array An associative array where key = timestamp of migration, value = full filename of the migration.
- _migrateUp(DateTime $stopAt)¶
Migrate upwards to a specific timestamp.
- $stopAt (DateTime) –
- _loadMigration(string $filename)¶
Require the migration file and return an instance of the class associated with it.
- $filename (string) – Migration script filename.
- _getPendingMigrations(DateTime $until)¶
Retrieve a list of all migrations that have not been run yet, ending at the latest time given by $until.
- $until (DateTime) –
- _recordMigration(string $time)¶
Record the migration timestamp in the schema_migrations table.
- $time (string) –