You are here

function shurly_schema in ShURLy 6

Same name and namespace in other branches
  1. 8 shurly.install \shurly_schema()
  2. 7 shurly.install \shurly_schema()

Implement hook_schema().

File

./shurly.install, line 10
Shurly install file

Code

function shurly_schema() {
  $schema = array();
  $schema['shurly'] = array(
    'description' => t('URL redirects for the Shurly module'),
    'fields' => array(
      'rid' => array(
        'description' => t('unique redirect id'),
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'uid' => array(
        'description' => t('user id of owner'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'source' => array(
        'description' => t('source path'),
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
      ),
      'destination' => array(
        'description' => t('redirect URL'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'hash' => array(
        'description' => t('The hash of the redirect URL'),
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
        'default' => '',
      ),
      'created' => array(
        'description' => t('datestamp of creation'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'count' => array(
        'description' => t('usage count'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'last_used' => array(
        'description' => t('datestamp of last use'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'custom' => array(
        'description' => t('flag for custom path'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'active' => array(
        'description' => t('allows links to be deactivated'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
    ),
    'primary key' => array(
      'rid',
    ),
    'indexes' => array(
      'source' => array(
        'source',
      ),
      'hash' => array(
        'hash',
      ),
    ),
  );
  $schema['shurly_flood'] = array(
    'description' => t('Flood controls the threshold of events, such as the number of contact attempts.'),
    'fields' => array(
      'fid' => array(
        'description' => t('Unique flood event ID.'),
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'event' => array(
        'description' => t('Name of event (e.g. contact).'),
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'identifier' => array(
        'description' => t('Identifier of the visitor, such as an IP address or hostname.'),
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'timestamp' => array(
        'description' => t('Timestamp of the event.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'expiration' => array(
        'description' => t('Expiration timestamp. Expired events are purged on cron run.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'fid',
    ),
    'indexes' => array(
      'allow' => array(
        'event',
        'identifier',
        'timestamp',
      ),
    ),
  );
  return $schema;
}