You are here

public static function Migration::deregisterMigration in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 includes/migration.inc \Migration::deregisterMigration()

Deregister a migration - remove all traces of it from the database (without touching any content which was created by this migration).

We'd like to do this at uninstall time, but the implementing module is already disabled, so we can't instantiate it to get at the map. This can be done in hook_disable(), however.

Parameters

string $machine_name:

Overrides MigrationBase::deregisterMigration

2 calls to Migration::deregisterMigration()
migrate_example_beer_disable in migrate_example/beer.install.inc
migrate_example_wine_disable in migrate_example/wine.install.inc

File

includes/migration.inc, line 154
Defines the base class for import/rollback processes.

Class

Migration
The base class for all import objects. This is where most of the smarts of the migrate module resides. Migrations are created by deriving from this class, and in the constructor (after calling parent::__construct()) initializing at a minimum the name,…

Code

public static function deregisterMigration($machine_name) {
  try {

    // Remove map and message tables
    $migration = self::getInstance($machine_name);
    $migration->map
      ->destroy();

    // TODO: Clear log entries? Or keep for historical purposes?
    // Call the parent deregistration (which clears migrate_status) last, the
    // above will reference it.
    parent::deregisterMigration($machine_name);
  } catch (Exception $e) {

    // Fail silently if it's already gone
  }
}