You are here

function user_import_schema in User Import 7

Same name and namespace in other branches
  1. 8 user_import.install \user_import_schema()
  2. 6.4 user_import.install \user_import_schema()
  3. 6.2 user_import.install \user_import_schema()
  4. 7.3 user_import.install \user_import_schema()
  5. 7.2 user_import.install \user_import_schema()

Implementation of hook_schema().

File

./user_import.install, line 11
Import and update users from a comma separated file (csv).

Code

function user_import_schema() {
  $schema['user_import'] = array(
    'description' => t("Settings for each import, and import setting templates."),
    'fields' => array(
      'import_id' => array(
        'description' => t("ID key of import or template."),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'disp-width' => '10',
      ),
      'name' => array(
        'description' => t("Label of import template, only used if this is an import template."),
        'type' => 'varchar',
        'length' => '25',
        'not null' => TRUE,
        'default' => '',
      ),
      'auto_import_directory' => array(
        'description' => t("Name of directory associated with an import template."),
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'filename' => array(
        'description' => t("Name of file being used as source of data for import."),
        'type' => 'varchar',
        'length' => '50',
        'not null' => TRUE,
        'default' => '',
      ),
      'oldfilename' => array(
        'description' => t("Original name of file being used as source of data for import."),
        'type' => 'varchar',
        'length' => '50',
        'not null' => TRUE,
        'default' => '',
      ),
      'filepath' => array(
        'description' => t("Path to file being used as source of data for import."),
        'type' => 'text',
        'size' => 'small',
        'not null' => TRUE,
      ),
      'started' => array(
        'description' => t("Datestamp of when import was started."),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'disp-width' => '11',
      ),
      'pointer' => array(
        'description' => t("Pointer to where test/import last finished."),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'disp-width' => '10',
      ),
      'processed' => array(
        'description' => t("Number of users processed by import."),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'disp-width' => '10',
      ),
      'valid' => array(
        'description' => t("Number of users processed without errors."),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'disp-width' => '10',
      ),
      'field_match' => array(
        'description' => t("Settings for how data matches to Drupal fields."),
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
      'roles' => array(
        'description' => t("Roles to give imported users."),
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
      'options' => array(
        'description' => t("Store of all other options for import. Most of the other settings in this table will be moved into here in future."),
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
      'setting' => array(
        'description' => t("Status of import, or whether it is an import template."),
        'type' => 'varchar',
        'length' => '10',
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'import_id',
    ),
  );
  $schema['user_import_errors'] = array(
    'description' => t("Record of errors encountered during an import."),
    'fields' => array(
      'import_id' => array(
        'description' => t("ID key of import or template."),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'disp-width' => '10',
      ),
      'data' => array(
        'description' => t("Data (matched to fields) for user that failed to import due to error."),
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
      'errors' => array(
        'description' => t("Error(s) encountered for user that failed to import."),
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
    ),
    'indexes' => array(
      'import_id' => array(
        'import_id',
      ),
    ),
  );
  return $schema;
}