You are here

function opigno_statistics_app_schema in Opigno Statistics App 7

Implements hook_schema().

File

./opigno_statistics_app.install, line 169
Contains install instructions and logic

Code

function opigno_statistics_app_schema() {
  $schema['opigno_statistics_login_history'] = array(
    'fields' => array(
      'opigno_statistics_login_history_pk' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'uid of user.',
      ),
      'user_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => "The user's name at the time",
      ),
      'user_email' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => "The user's email at the time",
      ),
      'last_login_count' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "Timestamp last login",
      ),
      'login_count' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "Number of logins",
        'default' => '1',
      ),
    ),
    'indexes' => array(
      'opigno_statistics_login_history_pk_index' => array(
        'opigno_statistics_login_history_pk',
      ),
      'opigno_statistics_login_history_uid_index' => array(
        'uid',
      ),
    ),
    'primary key' => array(
      'opigno_statistics_login_history_pk',
      'uid',
    ),
  );
  $schema['opigno_statistics_user_group'] = array(
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'uid of user.',
      ),
      'group_nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "the group nid",
      ),
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "the nid",
      ),
      'page_views' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "Number of pages viewed",
        'default' => '1',
      ),
    ),
    'indexes' => array(
      'opigno_statistics_user_group_uid' => array(
        'uid',
      ),
      'opigno_statistics_user_group_group_nid' => array(
        'group_nid',
      ),
      'opigno_statistics_user_group_nid' => array(
        'nid',
      ),
    ),
    'primary key' => array(
      'uid',
      'group_nid',
      'nid',
    ),
  );
  $schema['opigno_statistics_user'] = array(
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'uid of user.',
      ),
      'month_year' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "Timestamp (should be only month/year)",
      ),
      'page_views' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "Number of pages viewed",
        'default' => '1',
      ),
    ),
    'indexes' => array(
      'opigno_statistics_user_uid' => array(
        'uid',
      ),
      'opigno_statistics_user_month_year' => array(
        'month_year',
      ),
    ),
    'primary key' => array(
      'uid',
      'month_year',
    ),
  );
  $schema['opigno_statistics_group'] = array(
    'fields' => array(
      'group_nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'The group nid',
      ),
      'month_year' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "Timestamp (should be only month/year)",
      ),
      'category_taxonomy_term_id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "The category taxonomy term id",
      ),
      'category_taxonomy_term_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
        'description' => "The category name at the time",
      ),
      'group_title' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => "The group title at the time",
      ),
      'group_type' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => "The group type at the time",
      ),
      'page_views' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "Number of pages viewed",
        'default' => '1',
      ),
      'number_passed' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Number of quizzes passed',
        'default' => '0',
      ),
    ),
    'indexes' => array(
      'opigno_statistics_group_group_nid' => array(
        'group_nid',
      ),
      'opigno_statistics_group_month_year' => array(
        'month_year',
      ),
      'opigno_statistics_group_category_taxonomy_term_id' => array(
        'category_taxonomy_term_id',
      ),
    ),
    'primary key' => array(
      'group_nid',
      'month_year',
      'category_taxonomy_term_id',
    ),
  );
  $schema['opigno_statistics_user_course'] = array(
    'fields' => array(
      'opigno_statistics_user_course_pk' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "The user id",
      ),
      'username' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
        'description' => "The username",
      ),
      'course_nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "The course nid",
      ),
      'status' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => '0',
        'description' => "If the user has passed the course(1) or not(0)",
      ),
      'course_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
        'description' => "The course name",
      ),
      'score' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => '0',
        'description' => "The score",
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "The timestamp",
        'default' => '1',
      ),
    ),
    'indexes' => array(
      'opigno_statistics_user_course_pk' => array(
        'opigno_statistics_user_course_pk',
      ),
      'opigno_statistics_user_course_uid' => array(
        'uid',
      ),
      'opigno_statistics_user_course_course_nid' => array(
        'course_nid',
      ),
    ),
    'primary key' => array(
      'opigno_statistics_user_course_pk',
      'uid',
      'course_nid',
    ),
  );
  $schema['opigno_statistics_user_course_details'] = array(
    'fields' => array(
      'opigno_statistics_user_course_details_pk' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'opigno_statistics_user_course_fk' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "The statisitcs user course fk",
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => "The type (quiz,webex,iht)",
      ),
      'entity_id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "The entity id",
      ),
      'entity_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => "The entity name",
      ),
      'score' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => '0',
        'description' => "The score",
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "The timestamp",
        'default' => '1',
      ),
      'status' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => '0',
        'description' => "If the user has passed it(1) or not(0)",
      ),
      'required' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => '0',
        'description' => "If it is required(1) or not(0)",
      ),
    ),
    'indexes' => array(
      'opigno_statistics_user_course_details_pk' => array(
        'opigno_statistics_user_course_details_pk',
      ),
      'opigno_statistics_user_course_fk' => array(
        'opigno_statistics_user_course_fk',
      ),
    ),
    'primary key' => array(
      'opigno_statistics_user_course_details_pk',
      'opigno_statistics_user_course_fk',
    ),
  );
  return $schema;
}