You are here

public static function MigrateDestinationTable::getKeySchema in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 plugins/destinations/table.inc \MigrateDestinationTable::getKeySchema()
3 calls to MigrateDestinationTable::getKeySchema()
MigrateDestinationRole::getKeySchema in plugins/destinations/user.inc
Get the key definition for the role table.
MigrateDestinationTable::rollback in plugins/destinations/table.inc
Delete a single row.
WineTableMigration::__construct in migrate_example/wine.inc
General initialization of a Migration object.
1 method overrides MigrateDestinationTable::getKeySchema()
MigrateDestinationRole::getKeySchema in plugins/destinations/user.inc
Get the key definition for the role table.

File

plugins/destinations/table.inc, line 33
Support for tables defined through the Schema API.

Class

MigrateDestinationTable
Destination class implementing migration into a single table defined through the Schema API.

Code

public static function getKeySchema($table_name = NULL) {
  if (empty($table_name)) {
    return array();
  }
  $schema = drupal_get_schema($table_name);
  $keys = array();
  foreach ($schema['primary key'] as $primary_key) {

    // We can't have any form of serial fields here, since the mapping table
    // already has it's own.
    $schema['fields'][$primary_key]['auto_increment'] = FALSE;
    if ($schema['fields'][$primary_key]['type'] == 'serial') {
      $schema['fields'][$primary_key]['type'] = 'int';
    }
    $keys[$primary_key] = $schema['fields'][$primary_key];
  }
  return $keys;
}