You are here

function path_redirect_schema in Path redirect 6

Implement hook_schema().

File

./path_redirect.install, line 11
Install and uninstall schema and functions for the path_redirect module.

Code

function path_redirect_schema() {
  $schema['path_redirect'] = array(
    'description' => 'Stores information on redirects.',
    'fields' => array(
      'rid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique path redirect ID.',
      ),
      'source' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'description' => 'The source path to redirect from.',
      ),
      'redirect' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'description' => 'The destination path to redirect to.',
      ),
      'query' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'description' => 'The query string to send to the destination.',
      ),
      'fragment' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => FALSE,
        'description' => 'An internal page anchor append to the destination.',
      ),
      'language' => array(
        'description' => 'The language this redirect is for; if blank, the alias will be used for unknown languages.',
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      ),
      'type' => array(
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'description' => 'The HTTP status code to use for the redirect.',
      ),
      'last_used' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The timestamp of when the redirect was last used.',
      ),
    ),
    'primary key' => array(
      'rid',
    ),
    'unique keys' => array(
      'source_language' => array(
        'source',
        'language',
      ),
    ),
  );
  return $schema;
}