Created
January 13, 2012 16:19
-
-
Save anonymous/1607294 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_schema(). | |
*/ | |
function vulnscan_schema() { | |
$schema['vulnscan_server'] = array( | |
'description' => 'Table for servers.', | |
'fields' => array( | |
'name' => array( | |
'description' => 'The server\'s name. Used in the cookie value.', | |
'type' => 'varchar', | |
'length' => 64, | |
'not null' => TRUE, | |
), | |
), | |
'primary key' => array('name'), | |
); | |
$schema['vulnscan_servergroup'] = array( | |
'description' => 'Table for server groups.', | |
'fields' => array( | |
'groupname' => array( | |
'description' => 'Name of the server group.', | |
'type' => 'varchar', | |
'length' => 100, | |
'not null' => TRUE, | |
), | |
), | |
'primary key' => array('groupname'), | |
); | |
$schema['vulnscan_servergroupmapping'] = array( | |
'description' => 'Table to map servers to server groups.', | |
'fields' => array( | |
'servername' => array( | |
'description' => 'The name of the server', | |
'type' => 'varchar', | |
'length' => 64, | |
'not null' => TRUE, | |
), | |
'groupname' => array( | |
'description' => 'The name of the server group', | |
'type' => 'varchar', | |
'length' => 100, | |
'not null' => TRUE, | |
), | |
), | |
'indexes' => array( | |
'index_servername' => array('servername'), | |
'index_groupname' => array('groupname'), | |
), | |
'foreign keys' => array( | |
'servername' => array( | |
'table' => 'vulnscan_server', | |
'columns' => array('servername' => 'name'), | |
), | |
'groupname' => array( | |
'table' => 'vulnscan_servergroup', | |
'columns' => array('groupname' => 'groupname'), | |
), | |
), | |
'unique keys' => array( | |
'servername_groupname' => array('servername', 'groupname'), | |
), | |
'primary key' => array('servername', 'groupname'), | |
); | |
$schema['vulnscan_userservermapping'] = array( | |
'description' => 'Table to map server groups to users.', | |
'fields' => array( | |
'uid' => array( | |
'description' => 'The {user}.uid of the logged-in user', | |
'type' => 'int', | |
'not null' => TRUE, | |
'unsigned' => TRUE, | |
), | |
'groupname' => array( | |
'description' => 'The {servergroup}.groupname of the server group', | |
'type' => 'varchar', | |
'length' => 100, | |
'not null' => TRUE, | |
), | |
), | |
'unique keys' => array( | |
'uid_groupname' => array('uid', 'groupname'), | |
), | |
'foreign keys' => array( | |
'uid' => array( | |
'table' => 'users', | |
'columns' => array('uid' => 'uid'), | |
), | |
'groupname' => array( | |
'table' => 'vulnscan_servergroup', | |
'columns' => array('groupname' => 'groupname'), | |
), | |
), | |
'primary key' => array('uid', 'groupname'), | |
); | |
$schema['vulnscan_scan'] = array( | |
'description' => 'Table for recorded scans.', | |
'fields' => array( | |
'scanid' => array( | |
'description' => 'The primary identifier for a scan.', | |
'type' => 'serial', | |
'unsigned' => TRUE, | |
'not null' => TRUE, | |
), | |
'uid' => array( | |
'description' => 'uid of owner.', | |
'type' => 'int', | |
'unsigned' => TRUE, | |
'not null' => TRUE, | |
), | |
'location' => array( | |
'description' => 'Location of the result files.', | |
'type' => 'varchar', | |
'length' => 500, | |
'not null' => TRUE, | |
), | |
), | |
'foreign keys' => array( | |
'uid' => array( | |
'table' => 'users', | |
'columns' => array('uid' => 'uid'), | |
), | |
), | |
'primary key' => array('scanid'), | |
); | |
return $schema; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment