Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. <?php
  2. // $Id:$
  3.  
  4. /**
  5.  *
  6.  * @file
  7.  * Schema for tables relative to quiz module extensions
  8.  *
  9.  */
  10. function qbpm_install() {
  11.   // go forth and make tables!
  12.   drupal_set_message('installing qbpm tables.');
  13.   drupal_install_schema('qbpm');
  14. }
  15.  
  16. function qbpm_schema() {
  17.   $schema = array();
  18.  
  19.   $schema['quiz_impersonations'] = array(
  20.     'description' => 'The base table for taking a *type* of quiz on the behalf of someone else',
  21.     'fields' => array(
  22.       'rid' => array(
  23.         'type' => 'serial',
  24.         'size' => 'normal',
  25.         'unsigned' => TRUE,
  26.         'not null' => TRUE,
  27.       ),
  28.       // user id of the 'impersonator'
  29.       'iuid' => array(
  30.         'type' => 'int',
  31.         'unsigned' => TRUE,
  32.         'not null' => TRUE,
  33.       ),
  34.       // user id of the individual on whose behalf we're evaluating
  35.       'auid' => array(
  36.         'type' => 'int',
  37.         'unsigned' => TRUE,
  38.         'not null' => TRUE,
  39.       ),
  40.       // date of the evaluation
  41.       // decided to change the 'datetime' type to an 'int'
  42.       // using unix style timestamps, in my opinion, is just less of
  43.       // a pain
  44.       'date' => array(
  45.         'type' => 'int',
  46.         'unsigned' => TRUE,
  47.         'not null' => TRUE,
  48.       ),
  49.     ),
  50.     'primary key' => array('rid'),
  51.   );
  52.  
  53.   return $schema;
  54. }
  55.  
  56. function qbpm_uninstall() {
  57.   drupal_uninstall_schema('qbpm');
  58.  
  59.   $tables = array(
  60.     'quiz_impersonations'
  61.   );
  62.  
  63.   foreach($tables as $table) {
  64.     variable_del($table);
  65.   }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement