You are here

function _migrate_map_table_schema in Migrate 6

Generate a map table schema record, given the source PK definition

Parameters

$sourcefield: Schema definition for the content set source's PK

Return value

Schema structure for a map table

3 calls to _migrate_map_table_schema()
MigrateUnitTest::testCRUD in tests/migrate_api.test
Test API for managing content sets
migrate_save_content_set in ./migrate.module
Save a new or updated content set
migrate_schema_alter in ./migrate.module
Implementation of hook_schema_alter().

File

./migrate.module, line 1367
This module provides tools at "administer >> content >> migrate" for analyzing data from various sources and importing them into Drupal tables.

Code

function _migrate_map_table_schema($sourcefield) {
  $schema = array(
    'description' => t('Mappings from source key to destination key'),
    'fields' => array(
      'sourceid' => $sourcefield,
      // @TODO: Assumes destination key is unsigned int
      'destid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'needs_update' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => (int) FALSE,
      ),
    ),
    'primary key' => array(
      'sourceid',
    ),
    'indexes' => array(
      'idkey' => array(
        'destid',
      ),
    ),
  );
  return $schema;
}