Skip to content
Snippets Groups Projects
Forked from project / sshkey
1 commit ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
sshkey.install 1.98 KiB
<?php

/**
 * @file
 * Install, uninstall, schema, and requirements for sshkey.
 */

/**
 * Implements hook_schema().
 */
function sshkey_schema() {
  $schema['sshkey'] = array(
    'description' => 'Stores SSH public keys associated with entities.',
    'fields' => array(
      'key_id' => array(
        'description' => 'The autoincrement primary key SSH key ID.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'entity_type' => array(
        'description' => 'The type of entity (e.g. node, user, etc.).',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_id' => array(
        'description' => 'The ID of the entity.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'fingerprint' => array(
        'description' => 'The unique fingerprint (MD5 hash) of the key.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'title' => array(
        'description' => 'The nickname of the key file.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'value' => array(
        'description' => 'The raw key value.',
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
      ),
      'changed' => array(
        'description' => 'The time that the key was created or updated, as a UNIX timestamp.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array('key_id'),
    'unique keys' => array(
      'fingerprint' => array('fingerprint'),
    ),
    'indexes' => array(
      'entity_type_id' => array('entity_type', 'entity_id'),
    ),
  );
  return $schema;
}

/**
 * Impelements hook_uninstall().
 */
function sshkey_uninstall() {
  // Remove variables.
  variable_del('sshkey_help');
}