SET SESSION sql_mode = 'STRICT_ALL_TABLES,ANSI_QUOTES';

CREATE TABLE pu_00config (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00conf_nam_uix (name)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Moodle configuration variables';
CREATE TABLE pu_00config_plugins (
    id BIGINT(10) NOT NULL auto_increment,
    plugin VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'core',
    name VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00confplug_plunam_uix (plugin, name)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Moodle modules and plugins configuration variables';
CREATE TABLE pu_00config_log (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    plugin VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    name VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    oldvalue LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00conflog_tim_ix (timemodified)
, KEY pu_00conflog_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Changes done in server configuration through admin UI';
CREATE TABLE pu_00upgrade_log (
    id BIGINT(10) NOT NULL auto_increment,
    type BIGINT(10) NOT NULL,
    plugin VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    version VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    targetversion VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    info VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    details LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    backtrace LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    userid BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00upgrlog_tim_ix (timemodified)
, KEY pu_00upgrlog_typtim_ix (type, timemodified)
, KEY pu_00upgrlog_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Upgrade logging';
CREATE TABLE pu_00course (
    id BIGINT(10) NOT NULL auto_increment,
    category BIGINT(10) NOT NULL DEFAULT 0,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
    fullname VARCHAR(1333) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    shortname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    idnumber VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    summary LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    summaryformat TINYINT(2) NOT NULL DEFAULT 0,
    format VARCHAR(21) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'topics',
    showgrades TINYINT(2) NOT NULL DEFAULT 1,
    newsitems MEDIUMINT(5) NOT NULL DEFAULT 1,
    startdate BIGINT(10) NOT NULL DEFAULT 0,
    enddate BIGINT(10) NOT NULL DEFAULT 0,
    marker BIGINT(10) NOT NULL DEFAULT 0,
    maxbytes BIGINT(10) NOT NULL DEFAULT 0,
    legacyfiles SMALLINT(4) NOT NULL DEFAULT 0,
    showreports SMALLINT(4) NOT NULL DEFAULT 0,
    visible TINYINT(1) NOT NULL DEFAULT 1,
    visibleold TINYINT(1) NOT NULL DEFAULT 1,
    groupmode SMALLINT(4) NOT NULL DEFAULT 0,
    groupmodeforce SMALLINT(4) NOT NULL DEFAULT 0,
    defaultgroupingid BIGINT(10) NOT NULL DEFAULT 0,
    lang VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    calendartype VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    theme VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    requested TINYINT(1) NOT NULL DEFAULT 0,
    enablecompletion TINYINT(1) NOT NULL DEFAULT 0,
    completionstartonenrol TINYINT(1) NOT NULL DEFAULT 0,
    completionprogressonview TINYINT(1) NOT NULL DEFAULT 0,
    completionnotify TINYINT(1) NOT NULL DEFAULT 0,
    audiencevisible SMALLINT(4) NOT NULL DEFAULT 2,
    cacherev BIGINT(10) NOT NULL DEFAULT 0,
    coursetype SMALLINT(4) NOT NULL DEFAULT 0,
    icon VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00cour_idn_ix (idnumber)
, KEY pu_00cour_sho_ix (shortname)
, KEY pu_00cour_sor_ix (sortorder)
, KEY pu_00cour_aud_ix (audiencevisible)
, KEY pu_00cour_catsor_ix (category, sortorder)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Central course table';
CREATE TABLE pu_00course_categories (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    idnumber VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 0,
    parent BIGINT(10) NOT NULL DEFAULT 0,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
    coursecount BIGINT(10) NOT NULL DEFAULT 0,
    visible TINYINT(1) NOT NULL DEFAULT 1,
    visibleold TINYINT(1) NOT NULL DEFAULT 1,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    depth BIGINT(10) NOT NULL DEFAULT 0,
    path VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    theme VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci,
    programcount BIGINT(10) NOT NULL DEFAULT 0,
    certifcount BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00courcate_par_ix (parent)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Course categories';
CREATE TABLE pu_00course_completion_aggr_methd (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    criteriatype BIGINT(10),
    method TINYINT(1) NOT NULL DEFAULT 0,
    value NUMERIC(10,5),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00courcompaggrmeth_cou_ix (course)
, KEY pu_00courcompaggrmeth_cri_ix (criteriatype)
, UNIQUE KEY pu_00courcompaggrmeth_couc_uix (course, criteriatype)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Course completion aggregation methods for criteria';
CREATE TABLE pu_00course_completion_criteria (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    criteriatype BIGINT(10) NOT NULL DEFAULT 0,
    module VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    moduleinstance BIGINT(10),
    courseinstance BIGINT(10),
    enrolperiod BIGINT(10),
    timeend BIGINT(10),
    gradepass NUMERIC(10,5),
    role BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00courcompcrit_cou_ix (course)
, KEY pu_00courcompcrit_mod_ix (moduleinstance)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Course completion criteria';
CREATE TABLE pu_00course_completion_crit_compl (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    course BIGINT(10) NOT NULL DEFAULT 0,
    criteriaid BIGINT(10) NOT NULL DEFAULT 0,
    gradefinal NUMERIC(10,5),
    unenroled BIGINT(10),
    rpl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecompleted BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00courcompcritcomp_use_ix (userid)
, KEY pu_00courcompcritcomp_cou_ix (course)
, KEY pu_00courcompcritcomp_cri_ix (criteriaid)
, KEY pu_00courcompcritcomp_tim_ix (timecompleted)
, UNIQUE KEY pu_00courcompcritcomp_usec_uix (userid, course, criteriaid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Course completion user records';
CREATE TABLE pu_00course_completions (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    course BIGINT(10) NOT NULL DEFAULT 0,
    organisationid BIGINT(10),
    positionid BIGINT(10),
    timeenrolled BIGINT(10) NOT NULL DEFAULT 0,
    timestarted BIGINT(10) NOT NULL DEFAULT 0,
    timecompleted BIGINT(10),
    reaggregate BIGINT(10) NOT NULL DEFAULT 0,
    rpl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    rplgrade NUMERIC(10,5),
    invalidatecache TINYINT(1) DEFAULT 0,
    status TINYINT(2) NOT NULL DEFAULT 0,
    renewalstatus TINYINT(2) DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00courcomp_use_ix (userid)
, KEY pu_00courcomp_cou_ix (course)
, KEY pu_00courcomp_tim_ix (timecompleted)
, UNIQUE KEY pu_00courcomp_usecou_uix (userid, course)
, KEY pu_00courcomp_sta_ix (status)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Course completion records';
CREATE TABLE pu_00enrol (
    id BIGINT(10) NOT NULL auto_increment,
    enrol VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    status BIGINT(10) NOT NULL DEFAULT 0,
    courseid BIGINT(10) NOT NULL,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    enrolperiod BIGINT(10) DEFAULT 0,
    enrolstartdate BIGINT(10) DEFAULT 0,
    enrolenddate BIGINT(10) DEFAULT 0,
    expirynotify TINYINT(1) DEFAULT 0,
    expirythreshold BIGINT(10) DEFAULT 0,
    notifyall TINYINT(1) DEFAULT 0,
    password VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci,
    cost VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci,
    currency VARCHAR(3) CHARACTER SET utf8 COLLATE utf8_general_ci,
    roleid BIGINT(10) DEFAULT 0,
    customint1 BIGINT(10),
    customint2 BIGINT(10),
    customint3 BIGINT(10),
    customint4 BIGINT(10),
    customint5 BIGINT(10),
    customint6 BIGINT(10),
    customint7 BIGINT(10),
    customint8 BIGINT(10),
    customchar1 VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    customchar2 VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    customchar3 VARCHAR(1333) CHARACTER SET utf8 COLLATE utf8_general_ci,
    customdec1 NUMERIC(12,7),
    customdec2 NUMERIC(12,7),
    customtext1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    customtext2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    customtext3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    customtext4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00enro_enr_ix (enrol)
, KEY pu_00enro_cou_ix (courseid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Instances of enrolment plugins used in courses, fields marke';
CREATE TABLE pu_00user_enrolments (
    id BIGINT(10) NOT NULL auto_increment,
    status BIGINT(10) NOT NULL DEFAULT 0,
    enrolid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    timestart BIGINT(10) NOT NULL DEFAULT 0,
    timeend BIGINT(10) NOT NULL DEFAULT 2147483647,
    modifierid BIGINT(10) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00userenro_enruse_uix (enrolid, userid)
, KEY pu_00userenro_enr_ix (enrolid)
, KEY pu_00userenro_use_ix (userid)
, KEY pu_00userenro_mod_ix (modifierid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Users participating in courses (aka enrolled users) - everyb';
CREATE TABLE pu_00course_modules (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    module BIGINT(10) NOT NULL DEFAULT 0,
    instance BIGINT(10) NOT NULL DEFAULT 0,
    section BIGINT(10) NOT NULL DEFAULT 0,
    idnumber VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    added BIGINT(10) NOT NULL DEFAULT 0,
    score SMALLINT(4) NOT NULL DEFAULT 0,
    indent MEDIUMINT(5) NOT NULL DEFAULT 0,
    visible TINYINT(1) NOT NULL DEFAULT 1,
    visibleoncoursepage TINYINT(1) NOT NULL DEFAULT 1,
    visibleold TINYINT(1) NOT NULL DEFAULT 1,
    groupmode SMALLINT(4) NOT NULL DEFAULT 0,
    groupingid BIGINT(10) NOT NULL DEFAULT 0,
    completion TINYINT(1) NOT NULL DEFAULT 0,
    completiongradeitemnumber BIGINT(10),
    completionview TINYINT(1) NOT NULL DEFAULT 0,
    completionexpected BIGINT(10) NOT NULL DEFAULT 0,
    showdescription TINYINT(1) NOT NULL DEFAULT 0,
    availability LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    deletioninprogress TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00courmodu_vis_ix (visible)
, KEY pu_00courmodu_cou_ix (course)
, KEY pu_00courmodu_mod_ix (module)
, KEY pu_00courmodu_ins_ix (instance)
, KEY pu_00courmodu_idncou_ix (idnumber, course)
, KEY pu_00courmodu_gro_ix (groupingid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='course_modules table retrofitted from MySQL';
CREATE TABLE pu_00course_modules_completion (
    id BIGINT(10) NOT NULL auto_increment,
    coursemoduleid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    completionstate TINYINT(1) NOT NULL,
    viewed TINYINT(1),
    timemodified BIGINT(10) NOT NULL,
    timecompleted BIGINT(10),
    reaggregate BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00courmoducomp_cou_ix (coursemoduleid)
, UNIQUE KEY pu_00courmoducomp_usecou_uix (userid, coursemoduleid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores the completion state (completed or not completed, etc';
CREATE TABLE pu_00course_sections (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    section BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    summary LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    summaryformat TINYINT(2) NOT NULL DEFAULT 0,
    sequence LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    visible TINYINT(1) NOT NULL DEFAULT 1,
    availability LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00coursect_cousec_uix (course, section)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='to define the sections for each course';
CREATE TABLE pu_00course_request (
    id BIGINT(10) NOT NULL auto_increment,
    fullname VARCHAR(1333) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    shortname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    summary LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    summaryformat TINYINT(2) NOT NULL DEFAULT 0,
    category BIGINT(10) NOT NULL DEFAULT 0,
    reason LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    requester BIGINT(10) NOT NULL DEFAULT 0,
    password VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00courrequ_sho_ix (shortname)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='course requests';
CREATE TABLE pu_00course_format_options (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL,
    format VARCHAR(21) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    sectionid BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00courformopti_couforse_uix (courseid, format, sectionid, name)
, KEY pu_00courformopti_cou_ix (courseid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores format-specific options for the course or course sect';
CREATE TABLE pu_00filter_active (
    id BIGINT(10) NOT NULL auto_increment,
    filter VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    contextid BIGINT(10) NOT NULL,
    active SMALLINT(4) NOT NULL,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00filtacti_confil_uix (contextid, filter)
, KEY pu_00filtacti_con_ix (contextid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores information about which filters are active in which c';
CREATE TABLE pu_00filter_config (
    id BIGINT(10) NOT NULL auto_increment,
    filter VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    contextid BIGINT(10) NOT NULL,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00filtconf_confilnam_uix (contextid, filter, name)
, KEY pu_00filtconf_con_ix (contextid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores per-context configuration settings for filters which ';
CREATE TABLE pu_00event (
    id BIGINT(10) NOT NULL auto_increment,
    name LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    format SMALLINT(4) NOT NULL DEFAULT 0,
    categoryid BIGINT(10) NOT NULL DEFAULT 0,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    groupid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    repeatid BIGINT(10) NOT NULL DEFAULT 0,
    modulename VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    instance BIGINT(10) NOT NULL DEFAULT 0,
    type SMALLINT(4) NOT NULL DEFAULT 0,
    eventtype VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timestart BIGINT(10) NOT NULL DEFAULT 0,
    timeduration BIGINT(10) NOT NULL DEFAULT 0,
    timesort BIGINT(10),
    visible SMALLINT(4) NOT NULL DEFAULT 1,
    uuid VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    sequence BIGINT(10) NOT NULL DEFAULT 1,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    subscriptionid BIGINT(10),
    priority BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00even_cou_ix (courseid)
, KEY pu_00even_use_ix (userid)
, KEY pu_00even_tim_ix (timestart)
, KEY pu_00even_tim2_ix (timeduration)
, KEY pu_00even_typtim_ix (type, timesort)
, KEY pu_00even_grocouvisuse_ix (groupid, courseid, visible, userid)
, KEY pu_00even_cat_ix (categoryid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='For everything with a time associated to it';
CREATE TABLE pu_00cache_filters (
    id BIGINT(10) NOT NULL auto_increment,
    filter VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    version BIGINT(10) NOT NULL DEFAULT 0,
    md5key VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    rawtext LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00cachfilt_filmd5_ix (filter, md5key)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='For keeping information about cached data';
CREATE TABLE pu_00log (
    id BIGINT(10) NOT NULL auto_increment,
    time BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    ip VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    course BIGINT(10) NOT NULL DEFAULT 0,
    module VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    cmid BIGINT(10) NOT NULL DEFAULT 0,
    action VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    url VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    info VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00log_coumodact_ix (course, module, action)
, KEY pu_00log_tim_ix (time)
, KEY pu_00log_act_ix (action)
, KEY pu_00log_usecou_ix (userid, course)
, KEY pu_00log_cmi_ix (cmid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Every action is logged as far as possible';
CREATE TABLE pu_00log_queries (
    id BIGINT(10) NOT NULL auto_increment,
    qtype MEDIUMINT(5) NOT NULL,
    sqltext LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    sqlparams LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    error MEDIUMINT(5) NOT NULL DEFAULT 0,
    info LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    backtrace LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    exectime NUMERIC(10,5) NOT NULL,
    timelogged BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Logged database queries.';
CREATE TABLE pu_00log_display (
    id BIGINT(10) NOT NULL auto_increment,
    module VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    action VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    mtable VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    field VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00logdisp_modact_uix (module, action)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='For a particular module/action, specifies a moodle table/fie';
CREATE TABLE pu_00message (
    id BIGINT(10) NOT NULL auto_increment,
    useridfrom BIGINT(10) NOT NULL DEFAULT 0,
    useridto BIGINT(10) NOT NULL DEFAULT 0,
    subject LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullmessage LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullmessageformat SMALLINT(4) DEFAULT 0,
    fullmessagehtml LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    smallmessage LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    notification TINYINT(1) DEFAULT 0,
    contexturl LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    contexturlname LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timeuserfromdeleted BIGINT(10) NOT NULL DEFAULT 0,
    timeusertodeleted BIGINT(10) NOT NULL DEFAULT 0,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    eventtype VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00mess_useusetimtim_ix (useridfrom, useridto, timeuserfromdeleted, timeusertodeleted)
, KEY pu_00mess_usetimnot_ix (useridfrom, timeuserfromdeleted, notification)
, KEY pu_00mess_usetimnot2_ix (useridto, timeusertodeleted, notification)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores all unread messages';
CREATE TABLE pu_00message_read (
    id BIGINT(10) NOT NULL auto_increment,
    useridfrom BIGINT(10) NOT NULL DEFAULT 0,
    useridto BIGINT(10) NOT NULL DEFAULT 0,
    subject LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullmessage LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullmessageformat SMALLINT(4) DEFAULT 0,
    fullmessagehtml LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    smallmessage LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    notification TINYINT(1) DEFAULT 0,
    contexturl LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    contexturlname LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timeread BIGINT(10) NOT NULL DEFAULT 0,
    timeuserfromdeleted BIGINT(10) NOT NULL DEFAULT 0,
    timeusertodeleted BIGINT(10) NOT NULL DEFAULT 0,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    eventtype VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00messread_useusetimtim_ix (useridfrom, useridto, timeuserfromdeleted, timeusertodeleted)
, KEY pu_00messread_nottim_ix (notification, timeread)
, KEY pu_00messread_usetimnot_ix (useridfrom, timeuserfromdeleted, notification)
, KEY pu_00messread_usetimnot2_ix (useridto, timeusertodeleted, notification)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores all messages that have been read';
CREATE TABLE pu_00message_contacts (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    contactid BIGINT(10) NOT NULL DEFAULT 0,
    blocked TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00messcont_usecon_uix (userid, contactid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Maintains lists of relationships between users';
CREATE TABLE pu_00modules (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    cron BIGINT(10) NOT NULL DEFAULT 0,
    lastcron BIGINT(10) NOT NULL DEFAULT 0,
    search VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    visible TINYINT(1) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00modu_nam_ix (name)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='modules available in the site';
CREATE TABLE pu_00my_pages (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) DEFAULT 0,
    name VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    private TINYINT(1) NOT NULL DEFAULT 1,
    sortorder MEDIUMINT(6) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00mypage_usepri_ix (userid, private)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Extra user pages for the My Moodle system';
CREATE TABLE pu_00sessions (
    id BIGINT(10) NOT NULL auto_increment,
    state BIGINT(10) NOT NULL DEFAULT 0,
    sid VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    userid BIGINT(10) NOT NULL,
    sessdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    firstip VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_general_ci,
    lastip VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00sess_sta_ix (state)
, UNIQUE KEY pu_00sess_sid_uix (sid)
, KEY pu_00sess_tim_ix (timecreated)
, KEY pu_00sess_tim2_ix (timemodified)
, KEY pu_00sess_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Database based session storage - now recommended';
CREATE TABLE pu_00tenant (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(1333) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    idnumber VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 1,
    suspended TINYINT(1) NOT NULL DEFAULT 0,
    categoryid BIGINT(10) NOT NULL,
    cohortid BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    usercreated BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id),
CONSTRAINT pu_00tenant_categoryid_fk FOREIGN KEY (categoryid) REFERENCES pu_00course_categories (id) ON DELETE RESTRICT ON UPDATE RESTRICT
, UNIQUE KEY pu_00tena_idn_uix (idnumber)
, UNIQUE KEY pu_00tena_cat_uix (categoryid)
, KEY pu_00tena_use_ix (usercreated)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Totara Tenant information';
CREATE TABLE pu_00user (
    id BIGINT(10) NOT NULL auto_increment,
    auth VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'manual',
    confirmed TINYINT(1) NOT NULL DEFAULT 0,
    policyagreed TINYINT(1) NOT NULL DEFAULT 0,
    deleted TINYINT(1) NOT NULL DEFAULT 0,
    suspended TINYINT(1) NOT NULL DEFAULT 0,
    mnethostid BIGINT(10) NOT NULL DEFAULT 0,
    username VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    password VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    idnumber VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    firstname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    lastname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    email VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    emailstop TINYINT(1) NOT NULL DEFAULT 0,
    skype VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    phone1 VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    phone2 VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    institution VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    department VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    address VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    city VARCHAR(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    country VARCHAR(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    lang VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'en',
    calendartype VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'gregorian',
    theme VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timezone VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '99',
    firstaccess BIGINT(10) NOT NULL DEFAULT 0,
    lastaccess BIGINT(10) NOT NULL DEFAULT 0,
    lastlogin BIGINT(10) NOT NULL DEFAULT 0,
    currentlogin BIGINT(10) NOT NULL DEFAULT 0,
    lastip VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    secret VARCHAR(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    picture BIGINT(10) NOT NULL DEFAULT 0,
    url VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 1,
    mailformat TINYINT(1) NOT NULL DEFAULT 1,
    maildigest TINYINT(1) NOT NULL DEFAULT 0,
    maildisplay TINYINT(2) NOT NULL DEFAULT 2,
    autosubscribe TINYINT(1) NOT NULL DEFAULT 1,
    trackforums TINYINT(1) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    trustbitmask BIGINT(10) NOT NULL DEFAULT 0,
    imagealt VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    lastnamephonetic VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    firstnamephonetic VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    middlename VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    alternatename VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    totarasync TINYINT(1) NOT NULL DEFAULT 0,
    tenantid BIGINT(10),
CONSTRAINT  PRIMARY KEY (id),
CONSTRAINT pu_00user_tenantid_fk FOREIGN KEY (tenantid) REFERENCES pu_00tenant (id) ON DELETE RESTRICT ON UPDATE RESTRICT
, UNIQUE KEY pu_00user_mneuse_uix (mnethostid, username)
, KEY pu_00user_del_ix (deleted)
, KEY pu_00user_con_ix (confirmed)
, KEY pu_00user_fir_ix (firstname)
, KEY pu_00user_las_ix (lastname)
, KEY pu_00user_cit_ix (city)
, KEY pu_00user_cou_ix (country)
, KEY pu_00user_las2_ix (lastaccess)
, KEY pu_00user_ema_ix (email)
, KEY pu_00user_aut_ix (auth)
, KEY pu_00user_idn_ix (idnumber)
, KEY pu_00user_fir2_ix (firstnamephonetic)
, KEY pu_00user_las3_ix (lastnamephonetic)
, KEY pu_00user_mid_ix (middlename)
, KEY pu_00user_alt_ix (alternatename)
, KEY pu_00user_tot_ix (totarasync)
, KEY pu_00user_ten_ix (tenantid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='One record for each person';
CREATE TABLE pu_00user_preferences (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value VARCHAR(1333) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00userpref_usenam_uix (userid, name)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Allows modules to store arbitrary user preferences';
CREATE TABLE pu_00user_lastaccess (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    timeaccess BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00userlast_usecou_uix (userid, courseid)
, KEY pu_00userlast_use_ix (userid)
, KEY pu_00userlast_cou_ix (courseid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='To keep track of course page access times, used in online pa';
CREATE TABLE pu_00user_password_history (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    hash VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timecreated BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00userpasshist_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='A rotating log of hashes of previously used passwords for ea';
CREATE TABLE pu_00scale (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    scale LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00scal_cou_ix (courseid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines grading scales';
CREATE TABLE pu_00scale_history (
    id BIGINT(10) NOT NULL auto_increment,
    action BIGINT(10) NOT NULL DEFAULT 0,
    oldid BIGINT(10) NOT NULL,
    source VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timemodified BIGINT(10),
    loggeduser BIGINT(10),
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    scale LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00scalhist_act_ix (action)
, KEY pu_00scalhist_tim_ix (timemodified)
, KEY pu_00scalhist_old_ix (oldid)
, KEY pu_00scalhist_cou_ix (courseid)
, KEY pu_00scalhist_log_ix (loggeduser)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='History table';
CREATE TABLE pu_00stats_daily (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    timeend BIGINT(10) NOT NULL DEFAULT 0,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    stattype VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'activity',
    stat1 BIGINT(10) NOT NULL DEFAULT 0,
    stat2 BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00statdail_cou_ix (courseid)
, KEY pu_00statdail_tim_ix (timeend)
, KEY pu_00statdail_rol_ix (roleid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='to accumulate daily stats';
CREATE TABLE pu_00stats_weekly (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    timeend BIGINT(10) NOT NULL DEFAULT 0,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    stattype VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'activity',
    stat1 BIGINT(10) NOT NULL DEFAULT 0,
    stat2 BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00statweek_cou_ix (courseid)
, KEY pu_00statweek_tim_ix (timeend)
, KEY pu_00statweek_rol_ix (roleid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='To accumulate weekly stats';
CREATE TABLE pu_00stats_monthly (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    timeend BIGINT(10) NOT NULL DEFAULT 0,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    stattype VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'activity',
    stat1 BIGINT(10) NOT NULL DEFAULT 0,
    stat2 BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00statmont_cou_ix (courseid)
, KEY pu_00statmont_tim_ix (timeend)
, KEY pu_00statmont_rol_ix (roleid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='To accumulate monthly stats';
CREATE TABLE pu_00stats_user_daily (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    timeend BIGINT(10) NOT NULL DEFAULT 0,
    statsreads BIGINT(10) NOT NULL DEFAULT 0,
    statswrites BIGINT(10) NOT NULL DEFAULT 0,
    stattype VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00statuserdail_cou_ix (courseid)
, KEY pu_00statuserdail_use_ix (userid)
, KEY pu_00statuserdail_rol_ix (roleid)
, KEY pu_00statuserdail_tim_ix (timeend)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='To accumulate daily stats per course/user';
CREATE TABLE pu_00stats_user_weekly (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    timeend BIGINT(10) NOT NULL DEFAULT 0,
    statsreads BIGINT(10) NOT NULL DEFAULT 0,
    statswrites BIGINT(10) NOT NULL DEFAULT 0,
    stattype VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00statuserweek_cou_ix (courseid)
, KEY pu_00statuserweek_use_ix (userid)
, KEY pu_00statuserweek_rol_ix (roleid)
, KEY pu_00statuserweek_tim_ix (timeend)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='To accumulate weekly stats per course/user';
CREATE TABLE pu_00stats_user_monthly (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    timeend BIGINT(10) NOT NULL DEFAULT 0,
    statsreads BIGINT(10) NOT NULL DEFAULT 0,
    statswrites BIGINT(10) NOT NULL DEFAULT 0,
    stattype VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00statusermont_cou_ix (courseid)
, KEY pu_00statusermont_use_ix (userid)
, KEY pu_00statusermont_rol_ix (roleid)
, KEY pu_00statusermont_tim_ix (timeend)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='To accumulate monthly stats per course/user';
CREATE TABLE pu_00post (
    id BIGINT(10) NOT NULL auto_increment,
    module VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    userid BIGINT(10) NOT NULL DEFAULT 0,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    groupid BIGINT(10) NOT NULL DEFAULT 0,
    moduleid BIGINT(10) NOT NULL DEFAULT 0,
    coursemoduleid BIGINT(10) NOT NULL DEFAULT 0,
    subject VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    summary LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    content LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    uniquehash VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    rating BIGINT(10) NOT NULL DEFAULT 0,
    format BIGINT(10) NOT NULL DEFAULT 0,
    summaryformat TINYINT(2) NOT NULL DEFAULT 0,
    attachment VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    publishstate VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'draft',
    lastmodified BIGINT(10) NOT NULL DEFAULT 0,
    created BIGINT(10) NOT NULL DEFAULT 0,
    usermodified BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00post_iduse_uix (id, userid)
, KEY pu_00post_las_ix (lastmodified)
, KEY pu_00post_mod_ix (module)
, KEY pu_00post_sub_ix (subject)
, KEY pu_00post_use_ix (usermodified)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Generic post table to hold data blog entries etc in differen';
CREATE TABLE pu_00role (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
    archetype VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00role_sor_uix (sortorder)
, UNIQUE KEY pu_00role_sho_uix (shortname)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='moodle roles';
CREATE TABLE pu_00context (
    id BIGINT(10) NOT NULL auto_increment,
    contextlevel BIGINT(10) NOT NULL DEFAULT 0,
    instanceid BIGINT(10) NOT NULL DEFAULT 0,
    path VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    depth TINYINT(2) NOT NULL DEFAULT 0,
    parentid BIGINT(10),
    tenantid BIGINT(10),
CONSTRAINT  PRIMARY KEY (id),
CONSTRAINT pu_00context_tenantid_fk FOREIGN KEY (tenantid) REFERENCES pu_00tenant (id) ON DELETE RESTRICT ON UPDATE RESTRICT
, UNIQUE KEY pu_00cont_conins_uix (contextlevel, instanceid)
, KEY pu_00cont_ins_ix (instanceid)
, KEY pu_00cont_pat_ix (path)
, KEY pu_00cont_par_ix (parentid)
, KEY pu_00cont_ten_ix (tenantid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='one of these must be set';
CREATE TABLE pu_00context_map (
    id BIGINT(10) NOT NULL auto_increment,
    parentid BIGINT(10) NOT NULL,
    childid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00contmap_parchi_uix (parentid, childid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Map context hierarchy into a flat structure to make parent-c';
CREATE TABLE pu_00capabilities (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    captype VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    contextlevel BIGINT(10) NOT NULL DEFAULT 0,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    riskbitmask BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00capa_nam_uix (name)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='this defines all capabilities';
CREATE TABLE pu_00role_allow_assign (
    id BIGINT(10) NOT NULL auto_increment,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    allowassign BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00rolealloassi_rolall_uix (roleid, allowassign)
, KEY pu_00rolealloassi_rol_ix (roleid)
, KEY pu_00rolealloassi_all_ix (allowassign)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='this defines what role can assign what role';
CREATE TABLE pu_00role_allow_override (
    id BIGINT(10) NOT NULL auto_increment,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    allowoverride BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00rolealloover_rolall_uix (roleid, allowoverride)
, KEY pu_00rolealloover_rol_ix (roleid)
, KEY pu_00rolealloover_all_ix (allowoverride)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='this defines what role can override what role';
CREATE TABLE pu_00role_allow_switch (
    id BIGINT(10) NOT NULL auto_increment,
    roleid BIGINT(10) NOT NULL,
    allowswitch BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00rolealloswit_rolall_uix (roleid, allowswitch)
, KEY pu_00rolealloswit_rol_ix (roleid)
, KEY pu_00rolealloswit_all_ix (allowswitch)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table stores which which other roles a user is allowed ';
CREATE TABLE pu_00role_assignments (
    id BIGINT(10) NOT NULL auto_increment,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    contextid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    modifierid BIGINT(10) NOT NULL DEFAULT 0,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemid BIGINT(10) NOT NULL DEFAULT 0,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00roleassi_sor_ix (sortorder)
, KEY pu_00roleassi_rolcon_ix (roleid, contextid)
, KEY pu_00roleassi_useconrol_ix (userid, contextid, roleid)
, KEY pu_00roleassi_comiteuse_ix (component, itemid, userid)
, KEY pu_00roleassi_rol_ix (roleid)
, KEY pu_00roleassi_con_ix (contextid)
, KEY pu_00roleassi_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='assigning roles in different context';
CREATE TABLE pu_00role_capabilities (
    id BIGINT(10) NOT NULL auto_increment,
    contextid BIGINT(10) NOT NULL DEFAULT 0,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    capability VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    permission BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    modifierid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00rolecapa_rolconcap_uix (roleid, contextid, capability)
, KEY pu_00rolecapa_rolcapper_ix (roleid, capability, permission)
, KEY pu_00rolecapa_rol_ix (roleid)
, KEY pu_00rolecapa_con_ix (contextid)
, KEY pu_00rolecapa_mod_ix (modifierid)
, KEY pu_00rolecapa_cap_ix (capability)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='permission has to be signed, overriding a capability for a p';
CREATE TABLE pu_00role_names (
    id BIGINT(10) NOT NULL auto_increment,
    roleid BIGINT(10) NOT NULL DEFAULT 0,
    contextid BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00rolename_rolcon_uix (roleid, contextid)
, KEY pu_00rolename_rol_ix (roleid)
, KEY pu_00rolename_con_ix (contextid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='role names in native strings';
CREATE TABLE pu_00role_context_levels (
    id BIGINT(10) NOT NULL auto_increment,
    roleid BIGINT(10) NOT NULL,
    contextlevel BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00rolecontleve_conrol_uix (contextlevel, roleid)
, KEY pu_00rolecontleve_rol_ix (roleid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Lists which roles can be assigned at which context levels. T';
CREATE TABLE pu_00user_info_field (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'shortname',
    name LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    datatype VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 0,
    categoryid BIGINT(10) NOT NULL DEFAULT 0,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
    required TINYINT(2) NOT NULL DEFAULT 0,
    locked TINYINT(2) NOT NULL DEFAULT 0,
    visible SMALLINT(4) NOT NULL DEFAULT 0,
    forceunique TINYINT(2) NOT NULL DEFAULT 0,
    signup TINYINT(2) NOT NULL DEFAULT 0,
    defaultdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    defaultdataformat TINYINT(2) NOT NULL DEFAULT 0,
    param1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param5 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Customisable user profile fields';
CREATE TABLE pu_00user_info_category (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Customisable fields categories';
CREATE TABLE pu_00user_info_data (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    fieldid BIGINT(10) NOT NULL DEFAULT 0,
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    dataformat TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00userinfodata_usefie_uix (userid, fieldid)
, KEY pu_00userinfodata_fie_ix (fieldid)
, KEY pu_00userinfodata_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Data for the customisable user fields';
CREATE TABLE pu_00question_categories (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    contextid BIGINT(10) NOT NULL DEFAULT 0,
    info LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    infoformat TINYINT(2) NOT NULL DEFAULT 0,
    stamp VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    parent BIGINT(10) NOT NULL DEFAULT 0,
    sortorder BIGINT(10) NOT NULL DEFAULT 999,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quescate_con_ix (contextid)
, UNIQUE KEY pu_00quescate_consta_uix (contextid, stamp)
, KEY pu_00quescate_par_ix (parent)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Categories are for grouping questions';
CREATE TABLE pu_00question (
    id BIGINT(10) NOT NULL auto_increment,
    category BIGINT(10) NOT NULL DEFAULT 0,
    parent BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    questiontext LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    questiontextformat TINYINT(2) NOT NULL DEFAULT 0,
    generalfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    generalfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    defaultmark NUMERIC(12,7) NOT NULL DEFAULT 1,
    penalty NUMERIC(12,7) NOT NULL DEFAULT 0.3333333,
    qtype VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    length BIGINT(10) NOT NULL DEFAULT 1,
    stamp VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    version VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    hidden TINYINT(1) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    createdby BIGINT(10),
    modifiedby BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00ques_qty_ix (qtype)
, KEY pu_00ques_cat_ix (category)
, KEY pu_00ques_par_ix (parent)
, KEY pu_00ques_cre_ix (createdby)
, KEY pu_00ques_mod_ix (modifiedby)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='The questions themselves';
CREATE TABLE pu_00question_answers (
    id BIGINT(10) NOT NULL auto_increment,
    question BIGINT(10) NOT NULL DEFAULT 0,
    answer LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    answerformat TINYINT(2) NOT NULL DEFAULT 0,
    fraction NUMERIC(12,7) NOT NULL DEFAULT 0,
    feedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    feedbackformat TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesansw_que_ix (question)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Answers, with a fractional grade (0-1) and feedback';
CREATE TABLE pu_00question_hints (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL,
    hint LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    hintformat SMALLINT(4) NOT NULL DEFAULT 0,
    shownumcorrect TINYINT(1),
    clearwrong TINYINT(1),
    options VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00queshint_que_ix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores the the part of the question definition that gives di';
CREATE TABLE pu_00question_usages (
    id BIGINT(10) NOT NULL auto_increment,
    contextid BIGINT(10) NOT NULL,
    component VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    preferredbehaviour VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesusag_con_ix (contextid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table\'s main purpose it to assign a unique id to each a';
CREATE TABLE pu_00question_attempts (
    id BIGINT(10) NOT NULL auto_increment,
    questionusageid BIGINT(10) NOT NULL,
    slot BIGINT(10) NOT NULL,
    behaviour VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    questionid BIGINT(10) NOT NULL,
    variant BIGINT(10) NOT NULL DEFAULT 1,
    maxmark NUMERIC(12,7) NOT NULL,
    minfraction NUMERIC(12,7) NOT NULL,
    maxfraction NUMERIC(12,7) NOT NULL DEFAULT 1,
    flagged TINYINT(1) NOT NULL DEFAULT 0,
    questionsummary LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    rightanswer LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    responsesummary LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timemodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00quesatte_queslo_uix (questionusageid, slot)
, KEY pu_00quesatte_beh_ix (behaviour)
, KEY pu_00quesatte_que_ix (questionid)
, KEY pu_00quesatte_que2_ix (questionusageid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Each row here corresponds to an attempt at one question, as ';
CREATE TABLE pu_00question_attempt_steps (
    id BIGINT(10) NOT NULL auto_increment,
    questionattemptid BIGINT(10) NOT NULL,
    sequencenumber BIGINT(10) NOT NULL,
    state VARCHAR(13) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    fraction NUMERIC(12,7),
    timecreated BIGINT(10) NOT NULL,
    userid BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00quesattestep_queseq_uix (questionattemptid, sequencenumber)
, KEY pu_00quesattestep_que_ix (questionattemptid)
, KEY pu_00quesattestep_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores one step in in a question attempt. As well as the dat';
CREATE TABLE pu_00question_attempt_step_data (
    id BIGINT(10) NOT NULL auto_increment,
    attemptstepid BIGINT(10) NOT NULL,
    name VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesattestepdata_att_ix (attemptstepid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Each question_attempt_step has an associative array of the d';
CREATE TABLE pu_00question_statistics (
    id BIGINT(10) NOT NULL auto_increment,
    hashcode VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timemodified BIGINT(10) NOT NULL,
    questionid BIGINT(10) NOT NULL,
    slot BIGINT(10),
    subquestion SMALLINT(4) NOT NULL,
    variant BIGINT(10),
    s BIGINT(10) NOT NULL DEFAULT 0,
    effectiveweight NUMERIC(15,5),
    negcovar TINYINT(2) NOT NULL DEFAULT 0,
    discriminationindex NUMERIC(15,5),
    discriminativeefficiency NUMERIC(15,5),
    sd NUMERIC(15,10),
    facility NUMERIC(15,10),
    subquestions LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    maxmark NUMERIC(12,7),
    positions LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    randomguessscore NUMERIC(12,7),
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Statistics for individual questions used in an activity.';
CREATE TABLE pu_00question_response_analysis (
    id BIGINT(10) NOT NULL auto_increment,
    hashcode VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    whichtries VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timemodified BIGINT(10) NOT NULL,
    questionid BIGINT(10) NOT NULL,
    variant BIGINT(10),
    subqid VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    aid VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    response LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    credit NUMERIC(15,5) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Analysis of student responses given to questions.';
CREATE TABLE pu_00question_response_count (
    id BIGINT(10) NOT NULL auto_increment,
    analysisid BIGINT(10) NOT NULL,
    try BIGINT(10) NOT NULL,
    rcount BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesrespcoun_ana_ix (analysisid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Count for each responses for each try at a question.';
CREATE TABLE pu_00mnet_application (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    display_name VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    xmlrpc_server_url VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    sso_land_url VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    sso_jump_url VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Information about applications on remote hosts';
CREATE TABLE pu_00mnet_host (
    id BIGINT(10) NOT NULL auto_increment,
    deleted TINYINT(1) NOT NULL DEFAULT 0,
    wwwroot VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    ip_address VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    name VARCHAR(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    public_key LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    public_key_expires BIGINT(10) NOT NULL DEFAULT 0,
    transport TINYINT(2) NOT NULL DEFAULT 0,
    portno MEDIUMINT(5) NOT NULL DEFAULT 0,
    last_connect_time BIGINT(10) NOT NULL DEFAULT 0,
    last_log_id BIGINT(10) NOT NULL DEFAULT 0,
    force_theme TINYINT(1) NOT NULL DEFAULT 0,
    theme VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    applicationid BIGINT(10) NOT NULL DEFAULT 1,
    sslverification TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00mnethost_app_ix (applicationid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Information about the local and remote hosts for RPC';
CREATE TABLE pu_00mnet_host2service (
    id BIGINT(10) NOT NULL auto_increment,
    hostid BIGINT(10) NOT NULL DEFAULT 0,
    serviceid BIGINT(10) NOT NULL DEFAULT 0,
    publish TINYINT(1) NOT NULL DEFAULT 0,
    subscribe TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00mnethost_hosser_uix (hostid, serviceid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Information about the services for a given host';
CREATE TABLE pu_00mnet_log (
    id BIGINT(10) NOT NULL auto_increment,
    hostid BIGINT(10) NOT NULL DEFAULT 0,
    remoteid BIGINT(10) NOT NULL DEFAULT 0,
    time BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    ip VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    course BIGINT(10) NOT NULL DEFAULT 0,
    coursename VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    module VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    cmid BIGINT(10) NOT NULL DEFAULT 0,
    action VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    url VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    info VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00mnetlog_hosusecou_ix (hostid, userid, course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Store session data from users migrating to other sites';
CREATE TABLE pu_00mnet_rpc (
    id BIGINT(10) NOT NULL auto_increment,
    functionname VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    xmlrpcpath VARCHAR(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    plugintype VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    pluginname VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    enabled TINYINT(1) NOT NULL DEFAULT 0,
    help LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    profile LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    filename VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    classname VARCHAR(150) CHARACTER SET utf8 COLLATE utf8_general_ci,
    static TINYINT(1),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00mnetrpc_enaxml_ix (enabled, xmlrpcpath)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Functions or methods that we may publish or subscribe to';
CREATE TABLE pu_00mnet_remote_rpc (
    id BIGINT(10) NOT NULL auto_increment,
    functionname VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    xmlrpcpath VARCHAR(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    plugintype VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    pluginname VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    enabled TINYINT(1) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table describes functions that might be called remotely';
CREATE TABLE pu_00mnet_service (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    apiversion VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    offer TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='A service is a group of functions';
CREATE TABLE pu_00mnet_service2rpc (
    id BIGINT(10) NOT NULL auto_increment,
    serviceid BIGINT(10) NOT NULL DEFAULT 0,
    rpcid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00mnetserv_rpcser_uix (rpcid, serviceid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Group functions or methods under a service';
CREATE TABLE pu_00mnet_remote_service2rpc (
    id BIGINT(10) NOT NULL auto_increment,
    serviceid BIGINT(10) NOT NULL DEFAULT 0,
    rpcid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00mnetremoserv_rpcser_uix (rpcid, serviceid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Group functions or methods under a service';
CREATE TABLE pu_00mnet_session (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    username VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    token VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    mnethostid BIGINT(10) NOT NULL DEFAULT 0,
    useragent VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    confirm_timeout BIGINT(10) NOT NULL DEFAULT 0,
    session_id VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    expires BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00mnetsess_tok_uix (token)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Store session data from users migrating to other sites';
CREATE TABLE pu_00mnet_sso_access_control (
    id BIGINT(10) NOT NULL auto_increment,
    username VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    mnet_host_id BIGINT(10) NOT NULL DEFAULT 0,
    accessctrl VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'allow',
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00mnetssoaccecont_mneus_uix (mnet_host_id, username)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Users by host permitted (or not) to login from a remote prov';
CREATE TABLE pu_00events_queue (
    id BIGINT(10) NOT NULL auto_increment,
    eventdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    stackdump LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    userid BIGINT(10),
    timecreated BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00evenqueu_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table is for storing queued events. It stores only one ';
CREATE TABLE pu_00events_handlers (
    id BIGINT(10) NOT NULL auto_increment,
    eventname VARCHAR(166) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    component VARCHAR(166) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    handlerfile VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    handlerfunction LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    schedule VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    status BIGINT(10) NOT NULL DEFAULT 0,
    internal TINYINT(2) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00evenhand_evecom_uix (eventname, component)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table is for storing which components requests what typ';
CREATE TABLE pu_00events_queue_handlers (
    id BIGINT(10) NOT NULL auto_increment,
    queuedeventid BIGINT(10) NOT NULL,
    handlerid BIGINT(10) NOT NULL,
    status BIGINT(10),
    errormessage LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timemodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00evenqueuhand_que_ix (queuedeventid)
, KEY pu_00evenqueuhand_han_ix (handlerid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This is the list of queued handlers for processing. The even';
CREATE TABLE pu_00grade_outcomes (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10),
    shortname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    fullname LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    scaleid BIGINT(10),
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 0,
    timecreated BIGINT(10),
    timemodified BIGINT(10),
    usermodified BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gradoutc_cou_ix (courseid)
, KEY pu_00gradoutc_sca_ix (scaleid)
, KEY pu_00gradoutc_use_ix (usermodified)
, UNIQUE KEY pu_00gradoutc_cousho_uix (courseid, shortname)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table describes the outcomes used in the system. An out';
CREATE TABLE pu_00grade_outcomes_courses (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL,
    outcomeid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gradoutccour_cou_ix (courseid)
, KEY pu_00gradoutccour_out_ix (outcomeid)
, UNIQUE KEY pu_00gradoutccour_couout_uix (courseid, outcomeid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='stores what outcomes are used in what courses.';
CREATE TABLE pu_00grade_categories (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL,
    parent BIGINT(10),
    depth BIGINT(10) NOT NULL DEFAULT 0,
    path VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    aggregation BIGINT(10) NOT NULL DEFAULT 0,
    keephigh BIGINT(10) NOT NULL DEFAULT 0,
    droplow BIGINT(10) NOT NULL DEFAULT 0,
    aggregateonlygraded TINYINT(1) NOT NULL DEFAULT 0,
    aggregateoutcomes TINYINT(1) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    hidden TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gradcate_cou_ix (courseid)
, KEY pu_00gradcate_par_ix (parent)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table keeps information about categories, used for grou';
CREATE TABLE pu_00grade_items (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10),
    categoryid BIGINT(10),
    itemname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    itemtype VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemmodule VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci,
    iteminstance BIGINT(10),
    itemnumber BIGINT(10),
    iteminfo LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    idnumber VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    calculation LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    gradetype SMALLINT(4) NOT NULL DEFAULT 1,
    grademax NUMERIC(10,5) NOT NULL DEFAULT 100,
    grademin NUMERIC(10,5) NOT NULL DEFAULT 0,
    scaleid BIGINT(10),
    outcomeid BIGINT(10),
    gradepass NUMERIC(10,5) NOT NULL DEFAULT 0,
    multfactor NUMERIC(10,5) NOT NULL DEFAULT 1.0,
    plusfactor NUMERIC(10,5) NOT NULL DEFAULT 0,
    aggregationcoef NUMERIC(10,5) NOT NULL DEFAULT 0,
    aggregationcoef2 NUMERIC(10,5) NOT NULL DEFAULT 0,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
    display BIGINT(10) NOT NULL DEFAULT 0,
    decimals TINYINT(1),
    hidden BIGINT(10) NOT NULL DEFAULT 0,
    locked BIGINT(10) NOT NULL DEFAULT 0,
    locktime BIGINT(10) NOT NULL DEFAULT 0,
    needsupdate BIGINT(10) NOT NULL DEFAULT 0,
    weightoverride TINYINT(1) NOT NULL DEFAULT 0,
    timecreated BIGINT(10),
    timemodified BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00graditem_locloc_ix (locked, locktime)
, KEY pu_00graditem_itenee_ix (itemtype, needsupdate)
, KEY pu_00graditem_gra_ix (gradetype)
, KEY pu_00graditem_idncou_ix (idnumber, courseid)
, KEY pu_00graditem_cou_ix (courseid)
, KEY pu_00graditem_cat_ix (categoryid)
, KEY pu_00graditem_sca_ix (scaleid)
, KEY pu_00graditem_out_ix (outcomeid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table keeps information about gradeable items (ie colum';
CREATE TABLE pu_00grade_grades (
    id BIGINT(10) NOT NULL auto_increment,
    itemid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    rawgrade NUMERIC(10,5),
    rawgrademax NUMERIC(10,5) NOT NULL DEFAULT 100,
    rawgrademin NUMERIC(10,5) NOT NULL DEFAULT 0,
    rawscaleid BIGINT(10),
    usermodified BIGINT(10),
    finalgrade NUMERIC(10,5),
    hidden BIGINT(10) NOT NULL DEFAULT 0,
    locked BIGINT(10) NOT NULL DEFAULT 0,
    locktime BIGINT(10) NOT NULL DEFAULT 0,
    exported BIGINT(10) NOT NULL DEFAULT 0,
    overridden BIGINT(10) NOT NULL DEFAULT 0,
    excluded BIGINT(10) NOT NULL DEFAULT 0,
    feedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    feedbackformat BIGINT(10) NOT NULL DEFAULT 0,
    information LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    informationformat BIGINT(10) NOT NULL DEFAULT 0,
    timecreated BIGINT(10),
    timemodified BIGINT(10),
    aggregationstatus VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'unknown',
    aggregationweight NUMERIC(10,5),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gradgrad_locloc_ix (locked, locktime)
, KEY pu_00gradgrad_ite_ix (itemid)
, KEY pu_00gradgrad_use_ix (userid)
, KEY pu_00gradgrad_raw_ix (rawscaleid)
, KEY pu_00gradgrad_use2_ix (usermodified)
, UNIQUE KEY pu_00gradgrad_useite_uix (userid, itemid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='grade_grades  This table keeps individual grades for each us';
CREATE TABLE pu_00grade_outcomes_history (
    id BIGINT(10) NOT NULL auto_increment,
    action BIGINT(10) NOT NULL DEFAULT 0,
    oldid BIGINT(10) NOT NULL,
    source VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timemodified BIGINT(10),
    loggeduser BIGINT(10),
    courseid BIGINT(10),
    shortname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    fullname LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    scaleid BIGINT(10),
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gradoutchist_act_ix (action)
, KEY pu_00gradoutchist_tim_ix (timemodified)
, KEY pu_00gradoutchist_old_ix (oldid)
, KEY pu_00gradoutchist_cou_ix (courseid)
, KEY pu_00gradoutchist_sca_ix (scaleid)
, KEY pu_00gradoutchist_log_ix (loggeduser)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='History table';
CREATE TABLE pu_00grade_categories_history (
    id BIGINT(10) NOT NULL auto_increment,
    action BIGINT(10) NOT NULL DEFAULT 0,
    oldid BIGINT(10) NOT NULL,
    source VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timemodified BIGINT(10),
    loggeduser BIGINT(10),
    courseid BIGINT(10) NOT NULL,
    parent BIGINT(10),
    depth BIGINT(10) NOT NULL DEFAULT 0,
    path VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    aggregation BIGINT(10) NOT NULL DEFAULT 0,
    keephigh BIGINT(10) NOT NULL DEFAULT 0,
    droplow BIGINT(10) NOT NULL DEFAULT 0,
    aggregateonlygraded TINYINT(1) NOT NULL DEFAULT 0,
    aggregateoutcomes TINYINT(1) NOT NULL DEFAULT 0,
    aggregatesubcats TINYINT(1) NOT NULL DEFAULT 0,
    hidden TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gradcatehist_act_ix (action)
, KEY pu_00gradcatehist_tim_ix (timemodified)
, KEY pu_00gradcatehist_old_ix (oldid)
, KEY pu_00gradcatehist_cou_ix (courseid)
, KEY pu_00gradcatehist_par_ix (parent)
, KEY pu_00gradcatehist_log_ix (loggeduser)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='History of grade_categories';
CREATE TABLE pu_00grade_items_history (
    id BIGINT(10) NOT NULL auto_increment,
    action BIGINT(10) NOT NULL DEFAULT 0,
    oldid BIGINT(10) NOT NULL,
    source VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timemodified BIGINT(10),
    loggeduser BIGINT(10),
    courseid BIGINT(10),
    categoryid BIGINT(10),
    itemname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    itemtype VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemmodule VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci,
    iteminstance BIGINT(10),
    itemnumber BIGINT(10),
    iteminfo LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    idnumber VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    calculation LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    gradetype SMALLINT(4) NOT NULL DEFAULT 1,
    grademax NUMERIC(10,5) NOT NULL DEFAULT 100,
    grademin NUMERIC(10,5) NOT NULL DEFAULT 0,
    scaleid BIGINT(10),
    outcomeid BIGINT(10),
    gradepass NUMERIC(10,5) NOT NULL DEFAULT 0,
    multfactor NUMERIC(10,5) NOT NULL DEFAULT 1.0,
    plusfactor NUMERIC(10,5) NOT NULL DEFAULT 0,
    aggregationcoef NUMERIC(10,5) NOT NULL DEFAULT 0,
    aggregationcoef2 NUMERIC(10,5) NOT NULL DEFAULT 0,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
    hidden BIGINT(10) NOT NULL DEFAULT 0,
    locked BIGINT(10) NOT NULL DEFAULT 0,
    locktime BIGINT(10) NOT NULL DEFAULT 0,
    needsupdate BIGINT(10) NOT NULL DEFAULT 0,
    display BIGINT(10) NOT NULL DEFAULT 0,
    decimals TINYINT(1),
    weightoverride TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00graditemhist_act_ix (action)
, KEY pu_00graditemhist_tim_ix (timemodified)
, KEY pu_00graditemhist_old_ix (oldid)
, KEY pu_00graditemhist_cou_ix (courseid)
, KEY pu_00graditemhist_cat_ix (categoryid)
, KEY pu_00graditemhist_sca_ix (scaleid)
, KEY pu_00graditemhist_out_ix (outcomeid)
, KEY pu_00graditemhist_log_ix (loggeduser)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='History of grade_items';
CREATE TABLE pu_00grade_grades_history (
    id BIGINT(10) NOT NULL auto_increment,
    action BIGINT(10) NOT NULL DEFAULT 0,
    oldid BIGINT(10) NOT NULL,
    source VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timemodified BIGINT(10),
    loggeduser BIGINT(10),
    itemid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    rawgrade NUMERIC(10,5),
    rawgrademax NUMERIC(10,5) NOT NULL DEFAULT 100,
    rawgrademin NUMERIC(10,5) NOT NULL DEFAULT 0,
    rawscaleid BIGINT(10),
    usermodified BIGINT(10),
    finalgrade NUMERIC(10,5),
    hidden BIGINT(10) NOT NULL DEFAULT 0,
    locked BIGINT(10) NOT NULL DEFAULT 0,
    locktime BIGINT(10) NOT NULL DEFAULT 0,
    exported BIGINT(10) NOT NULL DEFAULT 0,
    overridden BIGINT(10) NOT NULL DEFAULT 0,
    excluded BIGINT(10) NOT NULL DEFAULT 0,
    feedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    feedbackformat BIGINT(10) NOT NULL DEFAULT 0,
    information LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    informationformat BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gradgradhist_act_ix (action)
, KEY pu_00gradgradhist_tim_ix (timemodified)
, KEY pu_00gradgradhist_useitetim_ix (userid, itemid, timemodified)
, KEY pu_00gradgradhist_old_ix (oldid)
, KEY pu_00gradgradhist_ite_ix (itemid)
, KEY pu_00gradgradhist_use_ix (userid)
, KEY pu_00gradgradhist_raw_ix (rawscaleid)
, KEY pu_00gradgradhist_use2_ix (usermodified)
, KEY pu_00gradgradhist_log_ix (loggeduser)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='History table';
CREATE TABLE pu_00grade_import_newitem (
    id BIGINT(10) NOT NULL auto_increment,
    itemname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    importcode BIGINT(10) NOT NULL,
    importer BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gradimponewi_imp_ix (importer)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='temporary table for storing new grade_item names from grade ';
CREATE TABLE pu_00grade_import_values (
    id BIGINT(10) NOT NULL auto_increment,
    itemid BIGINT(10),
    newgradeitem BIGINT(10),
    userid BIGINT(10) NOT NULL,
    finalgrade NUMERIC(10,5),
    feedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    importcode BIGINT(10) NOT NULL,
    importer BIGINT(10),
    importonlyfeedback TINYINT(1) DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gradimpovalu_ite_ix (itemid)
, KEY pu_00gradimpovalu_new_ix (newgradeitem)
, KEY pu_00gradimpovalu_imp_ix (importer)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Temporary table for importing grades';
CREATE TABLE pu_00tag_coll (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    isdefault TINYINT(2) NOT NULL DEFAULT 0,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    sortorder MEDIUMINT(5) NOT NULL DEFAULT 0,
    searchable TINYINT(2) NOT NULL DEFAULT 1,
    customurl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines different set of tags';
CREATE TABLE pu_00tag_area (
    id BIGINT(10) NOT NULL auto_increment,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemtype VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    enabled TINYINT(1) NOT NULL DEFAULT 1,
    tagcollid BIGINT(10) NOT NULL,
    callback VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    callbackfile VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    showstandard TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00tagarea_comite_uix (component, itemtype)
, KEY pu_00tagarea_tag_ix (tagcollid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines various tag areas, one area is identified by compone';
CREATE TABLE pu_00tag (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    tagcollid BIGINT(10) NOT NULL,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    rawname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    isstandard TINYINT(1) NOT NULL DEFAULT 0,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 0,
    flag SMALLINT(4) DEFAULT 0,
    timemodified BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00tag_tagnam_uix (tagcollid, name)
, KEY pu_00tag_tagiss_ix (tagcollid, isstandard)
, KEY pu_00tag_use_ix (userid)
, KEY pu_00tag_tag_ix (tagcollid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Tag table - this generic table will replace the old "tags" t';
CREATE TABLE pu_00tag_correlation (
    id BIGINT(10) NOT NULL auto_increment,
    tagid BIGINT(10) NOT NULL,
    correlatedtags LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00tagcorr_tag_ix (tagid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='The rationale for the \'tag_correlation\' table is performance';
CREATE TABLE pu_00tag_instance (
    id BIGINT(10) NOT NULL auto_increment,
    tagid BIGINT(10) NOT NULL,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemtype VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemid BIGINT(10) NOT NULL,
    contextid BIGINT(10),
    tiuserid BIGINT(10) NOT NULL DEFAULT 0,
    ordering BIGINT(10),
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00taginst_comiteitetiut_uix (component, itemtype, itemid, tiuserid, tagid)
, KEY pu_00taginst_itecomtagcon_ix (itemtype, component, tagid, contextid)
, KEY pu_00taginst_tag_ix (tagid)
, KEY pu_00taginst_con_ix (contextid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='tag_instance table holds the information of associations bet';
CREATE TABLE pu_00groups (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL,
    idnumber VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    name VARCHAR(254) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 0,
    enrolmentkey VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci,
    picture BIGINT(10) NOT NULL DEFAULT 0,
    hidepicture TINYINT(1) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00grou_idn_ix (idnumber)
, KEY pu_00grou_cou_ix (courseid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Each record represents a group.';
CREATE TABLE pu_00groupings (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    idnumber VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 0,
    configdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00grou_idn2_ix (idnumber)
, KEY pu_00grou_cou2_ix (courseid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='A grouping is a collection of groups. WAS: groups_groupings';
CREATE TABLE pu_00groups_members (
    id BIGINT(10) NOT NULL auto_increment,
    groupid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    timeadded BIGINT(10) NOT NULL DEFAULT 0,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00groumemb_gro_ix (groupid)
, KEY pu_00groumemb_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Link a user to a group.';
CREATE TABLE pu_00groupings_groups (
    id BIGINT(10) NOT NULL auto_increment,
    groupingid BIGINT(10) NOT NULL DEFAULT 0,
    groupid BIGINT(10) NOT NULL DEFAULT 0,
    timeadded BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00grougrou_gro_ix (groupingid)
, KEY pu_00grougrou_gro2_ix (groupid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Link a grouping to a group (note, groups can be in multiple ';
CREATE TABLE pu_00cohort (
    id BIGINT(10) NOT NULL auto_increment,
    contextid BIGINT(10) NOT NULL,
    name VARCHAR(254) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    idnumber VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2) NOT NULL,
    visible TINYINT(1) NOT NULL DEFAULT 1,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    cohorttype BIGINT(10) NOT NULL DEFAULT 1,
    modifierid BIGINT(10) NOT NULL DEFAULT 0,
    visibility TINYINT(1) NOT NULL DEFAULT 0,
    alertmembers TINYINT(1) NOT NULL DEFAULT 0,
    startdate BIGINT(10),
    enddate BIGINT(10),
    active TINYINT(1) NOT NULL DEFAULT 0,
    calculationstatus TINYINT(2) NOT NULL DEFAULT 1,
    activecollectionid BIGINT(10),
    draftcollectionid BIGINT(10),
    broken TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00coho_con_ix (contextid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Each record represents one cohort (aka site-wide group).';
CREATE TABLE pu_00cohort_members (
    id BIGINT(10) NOT NULL auto_increment,
    cohortid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    timeadded BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00cohomemb_cohuse_uix (cohortid, userid)
, KEY pu_00cohomemb_coh_ix (cohortid)
, KEY pu_00cohomemb_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Link a user to a cohort.';
CREATE TABLE pu_00user_private_key (
    id BIGINT(10) NOT NULL auto_increment,
    script VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    userid BIGINT(10) NOT NULL,
    instance BIGINT(10),
    iprestriction VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    validuntil BIGINT(10),
    timecreated BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00userprivkey_scrval_ix (script, value)
, KEY pu_00userprivkey_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='access keys used in cookieless scripts - rss, etc.';
CREATE TABLE pu_00grade_letters (
    id BIGINT(10) NOT NULL auto_increment,
    contextid BIGINT(10) NOT NULL,
    lowerboundary NUMERIC(10,5) NOT NULL,
    letter VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00gradlett_conlowlet_uix (contextid, lowerboundary, letter)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Repository for grade letters, for courses and other moodle e';
CREATE TABLE pu_00cache_flags (
    id BIGINT(10) NOT NULL auto_increment,
    flagtype VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    expiry BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00cachflag_nam_ix (name)
, KEY pu_00cachflag_flaexptim_ix (flagtype, expiry, timemodified)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Cache of time-sensitive flags';
CREATE TABLE pu_00grade_settings (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00gradsett_counam_uix (courseid, name)
, KEY pu_00gradsett_cou_ix (courseid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='gradebook settings';
CREATE TABLE pu_00portfolio_instance (
    id BIGINT(10) NOT NULL auto_increment,
    plugin VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    visible TINYINT(1) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='base table (not including config data) for instances of port';
CREATE TABLE pu_00portfolio_instance_config (
    id BIGINT(10) NOT NULL auto_increment,
    instance BIGINT(10) NOT NULL,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00portinstconf_nam_ix (name)
, KEY pu_00portinstconf_ins_ix (instance)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='config for portfolio plugin instances';
CREATE TABLE pu_00portfolio_instance_user (
    id BIGINT(10) NOT NULL auto_increment,
    instance BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00portinstuser_ins_ix (instance)
, KEY pu_00portinstuser_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='user data for portfolio instances.';
CREATE TABLE pu_00portfolio_log (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    time BIGINT(10) NOT NULL,
    portfolio BIGINT(10) NOT NULL,
    caller_class VARCHAR(150) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    caller_file VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    caller_component VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    caller_sha1 VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    tempdataid BIGINT(10) NOT NULL DEFAULT 0,
    returnurl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    continueurl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00portlog_use_ix (userid)
, KEY pu_00portlog_por_ix (portfolio)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='log of portfolio transfers (used to later check for duplicat';
CREATE TABLE pu_00portfolio_tempdata (
    id BIGINT(10) NOT NULL auto_increment,
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    expirytime BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    instance BIGINT(10) DEFAULT 0,
    queued TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00porttemp_use_ix (userid)
, KEY pu_00porttemp_ins_ix (instance)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='stores temporary data for portfolio exports. the id of this ';
CREATE TABLE pu_00message_providers (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    component VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    capability VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00messprov_comnam_uix (component, name)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table stores the message providers (modules and core sy';
CREATE TABLE pu_00message_processors (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(166) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    enabled TINYINT(1) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='List of message output plugins';
CREATE TABLE pu_00message_working (
    id BIGINT(10) NOT NULL auto_increment,
    unreadmessageid BIGINT(10) NOT NULL,
    processorid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00messwork_unr_ix (unreadmessageid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Lists all the messages and processors that need to be proces';
CREATE TABLE pu_00files (
    id BIGINT(10) NOT NULL auto_increment,
    contenthash VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    pathnamehash VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    contextid BIGINT(10) NOT NULL,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    filearea VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemid BIGINT(10) NOT NULL,
    filepath VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    filename VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    userid BIGINT(10),
    filesize BIGINT(10) NOT NULL,
    mimetype VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    status BIGINT(10) NOT NULL DEFAULT 0,
    source LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    author VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    license VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
    referencefileid BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00file_comfilconite_ix (component, filearea, contextid, itemid)
, KEY pu_00file_con_ix (contenthash)
, UNIQUE KEY pu_00file_pat_uix (pathnamehash)
, KEY pu_00file_con2_ix (contextid)
, KEY pu_00file_use_ix (userid)
, KEY pu_00file_ref_ix (referencefileid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='description of files, content is stored in sha1 file pool';
CREATE TABLE pu_00files_reference (
    id BIGINT(10) NOT NULL auto_increment,
    repositoryid BIGINT(10) NOT NULL,
    lastsync BIGINT(10),
    reference LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    referencehash VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00filerefe_refrep_uix (referencehash, repositoryid)
, KEY pu_00filerefe_rep_ix (repositoryid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Store files references';
CREATE TABLE pu_00file_conversion (
    id BIGINT(10) NOT NULL auto_increment,
    usermodified BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    sourcefileid BIGINT(10) NOT NULL,
    targetformat VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    status BIGINT(10) DEFAULT 0,
    statusmessage LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    converter VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    destfileid BIGINT(10),
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00fileconv_sou_ix (sourcefileid)
, KEY pu_00fileconv_des_ix (destfileid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Table to track file conversions.';
CREATE TABLE pu_00repository (
    id BIGINT(10) NOT NULL auto_increment,
    type VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    visible TINYINT(1) DEFAULT 1,
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table contains one entry for every configured external ';
CREATE TABLE pu_00repository_instances (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    typeid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    contextid BIGINT(10) NOT NULL,
    username VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    password VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10),
    timemodified BIGINT(10),
    readonly TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table contains one entry for every configured external ';
CREATE TABLE pu_00repository_instance_config (
    id BIGINT(10) NOT NULL auto_increment,
    instanceid BIGINT(10) NOT NULL,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='The config for intances';
CREATE TABLE pu_00backup_courses (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    laststarttime BIGINT(10) NOT NULL DEFAULT 0,
    lastendtime BIGINT(10) NOT NULL DEFAULT 0,
    laststatus VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '5',
    nextstarttime BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00backcour_cou_uix (courseid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='To store every course backup status';
CREATE TABLE pu_00block (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    cron BIGINT(10) NOT NULL DEFAULT 0,
    lastcron BIGINT(10) NOT NULL DEFAULT 0,
    visible TINYINT(1) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00bloc_nam_uix (name)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='contains all installed blocks';
CREATE TABLE pu_00block_instances (
    id BIGINT(10) NOT NULL auto_increment,
    blockname VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    parentcontextid BIGINT(10) NOT NULL,
    showinsubcontexts SMALLINT(4) NOT NULL,
    requiredbytheme SMALLINT(4) NOT NULL DEFAULT 0,
    pagetypepattern VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    subpagepattern VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci,
    defaultregion VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    defaultweight BIGINT(10) NOT NULL,
    configdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    common_config LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00blocinst_blo_ix (blockname)
, KEY pu_00blocinst_parshopagsub_ix (parentcontextid, showinsubcontexts, pagetypepattern, subpagepattern)
, KEY pu_00blocinst_tim_ix (timemodified)
, KEY pu_00blocinst_par_ix (parentcontextid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table stores block instances. The type of block this is';
CREATE TABLE pu_00block_positions (
    id BIGINT(10) NOT NULL auto_increment,
    blockinstanceid BIGINT(10) NOT NULL,
    contextid BIGINT(10) NOT NULL,
    pagetype VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    subpage VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    visible SMALLINT(4) NOT NULL,
    region VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    weight BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00blocposi_bloconpagsub_uix (blockinstanceid, contextid, pagetype, subpage)
, KEY pu_00blocposi_blo_ix (blockinstanceid)
, KEY pu_00blocposi_con_ix (contextid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores the position of a sticky block_instance on a another ';
CREATE TABLE pu_00comments (
    id BIGINT(10) NOT NULL auto_increment,
    contextid BIGINT(10) NOT NULL,
    component VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    commentarea VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemid BIGINT(10) NOT NULL,
    content LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    format TINYINT(2) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00comm_concomite_ix (contextid, commentarea, itemid)
, KEY pu_00comm_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='moodle comments module';
CREATE TABLE pu_00external_services (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    enabled TINYINT(1) NOT NULL,
    requiredcapability VARCHAR(150) CHARACTER SET utf8 COLLATE utf8_general_ci,
    restrictedusers TINYINT(1) NOT NULL,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10),
    shortname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    downloadfiles TINYINT(1) NOT NULL DEFAULT 0,
    uploadfiles TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00exteserv_nam_uix (name)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='built in and custom external services';
CREATE TABLE pu_00external_functions (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    classname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    methodname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    classpath VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    capabilities VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    services VARCHAR(1333) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00extefunc_nam_uix (name)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='list of all external functions';
CREATE TABLE pu_00external_services_functions (
    id BIGINT(10) NOT NULL auto_increment,
    externalserviceid BIGINT(10) NOT NULL,
    functionname VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00exteservfunc_ext_ix (externalserviceid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='lists functions available in each service group';
CREATE TABLE pu_00external_services_users (
    id BIGINT(10) NOT NULL auto_increment,
    externalserviceid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    iprestriction VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    validuntil BIGINT(10),
    timecreated BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00exteservuser_ext_ix (externalserviceid)
, KEY pu_00exteservuser_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='users allowed to use services with restricted users flag';
CREATE TABLE pu_00external_tokens (
    id BIGINT(10) NOT NULL auto_increment,
    token VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    tokentype SMALLINT(4) NOT NULL,
    userid BIGINT(10) NOT NULL,
    externalserviceid BIGINT(10) NOT NULL,
    sid VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci,
    contextid BIGINT(10) NOT NULL,
    creatorid BIGINT(10) NOT NULL DEFAULT 1,
    iprestriction VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    validuntil BIGINT(10),
    timecreated BIGINT(10) NOT NULL,
    lastaccess BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00extetoke_use_ix (userid)
, KEY pu_00extetoke_ext_ix (externalserviceid)
, KEY pu_00extetoke_con_ix (contextid)
, KEY pu_00extetoke_cre_ix (creatorid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Security tokens for accessing of external services';
CREATE TABLE pu_00blog_association (
    id BIGINT(10) NOT NULL auto_increment,
    contextid BIGINT(10) NOT NULL,
    blogid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00blogasso_con_ix (contextid)
, KEY pu_00blogasso_blo_ix (blogid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Associations of blog entries with courses and module instanc';
CREATE TABLE pu_00blog_external (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    url LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    filtertags VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    failedlastsync TINYINT(1) NOT NULL DEFAULT 0,
    timemodified BIGINT(10),
    timefetched BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00blogexte_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='External blog links used for RSS copying of blog entries to ';
CREATE TABLE pu_00rating (
    id BIGINT(10) NOT NULL auto_increment,
    contextid BIGINT(10) NOT NULL,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    ratingarea VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemid BIGINT(10) NOT NULL,
    scaleid BIGINT(10) NOT NULL,
    rating BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00rati_comratconite_ix (component, ratingarea, contextid, itemid)
, KEY pu_00rati_con_ix (contextid)
, KEY pu_00rati_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='moodle ratings';
CREATE TABLE pu_00license (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullname LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    source VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    enabled TINYINT(1) NOT NULL DEFAULT 1,
    version BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='store licenses used by moodle';
CREATE TABLE pu_00backup_controllers (
    id BIGINT(10) NOT NULL auto_increment,
    backupid VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    operation VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'backup',
    type VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemid BIGINT(10) NOT NULL,
    format VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    interactive SMALLINT(4) NOT NULL,
    purpose SMALLINT(4) NOT NULL,
    userid BIGINT(10) NOT NULL,
    status SMALLINT(4) NOT NULL,
    execution SMALLINT(4) NOT NULL,
    executiontime BIGINT(10) NOT NULL,
    checksum VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    controller LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00backcont_typite_ix (type, itemid)
, UNIQUE KEY pu_00backcont_bac_uix (backupid)
, KEY pu_00backcont_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='To store the backup_controllers as they are used';
CREATE TABLE pu_00backup_logs (
    id BIGINT(10) NOT NULL auto_increment,
    backupid VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    loglevel SMALLINT(4) NOT NULL,
    message LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    timecreated BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00backlogs_bacid_uix (backupid, id)
, KEY pu_00backlogs_bac_ix (backupid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='To store all the logs from backup and restore operations (by';
CREATE TABLE pu_00profiling (
    id BIGINT(10) NOT NULL auto_increment,
    runid VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    url VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    totalexecutiontime BIGINT(10) NOT NULL,
    totalcputime BIGINT(10) NOT NULL,
    totalcalls BIGINT(10) NOT NULL,
    totalmemory BIGINT(10) NOT NULL,
    runreference TINYINT(2) NOT NULL DEFAULT 0,
    runcomment VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timecreated BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00prof_urlrun_ix (url, runreference)
, KEY pu_00prof_timrun_ix (timecreated, runreference)
, UNIQUE KEY pu_00prof_run_uix (runid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores the results of all the profiling runs';
CREATE TABLE pu_00course_published (
    id BIGINT(10) NOT NULL auto_increment,
    huburl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    courseid BIGINT(10) NOT NULL,
    timepublished BIGINT(10) NOT NULL,
    enrollable TINYINT(1) NOT NULL DEFAULT 1,
    hubcourseid BIGINT(10) NOT NULL,
    status TINYINT(1) DEFAULT 0,
    timechecked BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Information about how and when an local courses were publish';
CREATE TABLE pu_00grading_areas (
    id BIGINT(10) NOT NULL auto_increment,
    contextid BIGINT(10) NOT NULL,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    areaname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    activemethod VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00gradarea_concomare_uix (contextid, component, areaname)
, KEY pu_00gradarea_con_ix (contextid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Identifies gradable areas where advanced grading can happen.';
CREATE TABLE pu_00grading_definitions (
    id BIGINT(10) NOT NULL auto_increment,
    areaid BIGINT(10) NOT NULL,
    method VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2),
    status BIGINT(10) NOT NULL DEFAULT 0,
    copiedfromid BIGINT(10),
    timecreated BIGINT(10) NOT NULL,
    usercreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
    timecopied BIGINT(10) DEFAULT 0,
    options LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00graddefi_are_ix (areaid)
, KEY pu_00graddefi_use_ix (usermodified)
, UNIQUE KEY pu_00graddefi_aremet_uix (areaid, method)
, KEY pu_00graddefi_use2_ix (usercreated)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Contains the basic information about an advanced grading for';
CREATE TABLE pu_00grading_instances (
    id BIGINT(10) NOT NULL auto_increment,
    definitionid BIGINT(10) NOT NULL,
    raterid BIGINT(10) NOT NULL,
    itemid BIGINT(10),
    rawgrade NUMERIC(10,5),
    status BIGINT(10) NOT NULL DEFAULT 0,
    feedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    feedbackformat TINYINT(2),
    timemodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gradinst_def_ix (definitionid)
, KEY pu_00gradinst_rat_ix (raterid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Grading form instance is an assessment record for one gradab';
CREATE TABLE pu_00event_subscriptions (
    id BIGINT(10) NOT NULL auto_increment,
    url VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    categoryid BIGINT(10) NOT NULL DEFAULT 0,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
    groupid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    eventtype VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    pollinterval BIGINT(10) NOT NULL DEFAULT 0,
    lastupdated BIGINT(10),
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Tracks subscriptions to remote calendars.';
CREATE TABLE pu_00badge (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    usercreated BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
    issuername VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    issuerurl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    issuercontact VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    expiredate BIGINT(10),
    expireperiod BIGINT(10),
    type TINYINT(1) NOT NULL DEFAULT 1,
    courseid BIGINT(10),
    message LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    messagesubject LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    attachment TINYINT(1) NOT NULL DEFAULT 1,
    notification TINYINT(1) NOT NULL DEFAULT 1,
    status TINYINT(1) NOT NULL DEFAULT 0,
    nextcron BIGINT(10),
    version VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    language VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    imageauthorname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    imageauthoremail VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    imageauthorurl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    imagecaption LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00badg_typ_ix (type)
, KEY pu_00badg_cou_ix (courseid)
, KEY pu_00badg_use_ix (usermodified)
, KEY pu_00badg_use2_ix (usercreated)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Defines badge';
CREATE TABLE pu_00badge_criteria (
    id BIGINT(10) NOT NULL auto_increment,
    badgeid BIGINT(10) NOT NULL DEFAULT 0,
    criteriatype BIGINT(10),
    method TINYINT(1) NOT NULL DEFAULT 1,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00badgcrit_cri_ix (criteriatype)
, UNIQUE KEY pu_00badgcrit_badcri_uix (badgeid, criteriatype)
, KEY pu_00badgcrit_bad_ix (badgeid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines criteria for issuing badges';
CREATE TABLE pu_00badge_criteria_param (
    id BIGINT(10) NOT NULL auto_increment,
    critid BIGINT(10) NOT NULL,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00badgcritpara_cri_ix (critid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines parameters for badges criteria';
CREATE TABLE pu_00badge_issued (
    id BIGINT(10) NOT NULL auto_increment,
    badgeid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    uniquehash LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    dateissued BIGINT(10) NOT NULL DEFAULT 0,
    dateexpire BIGINT(10),
    visible TINYINT(1) NOT NULL DEFAULT 0,
    issuernotified BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00badgissu_baduse_uix (badgeid, userid)
, KEY pu_00badgissu_bad_ix (badgeid)
, KEY pu_00badgissu_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines issued badges';
CREATE TABLE pu_00badge_criteria_met (
    id BIGINT(10) NOT NULL auto_increment,
    issuedid BIGINT(10),
    critid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    datemet BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00badgcritmet_cri_ix (critid)
, KEY pu_00badgcritmet_use_ix (userid)
, KEY pu_00badgcritmet_iss_ix (issuedid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines criteria that were met for an issued badge';
CREATE TABLE pu_00badge_endorsement (
    id BIGINT(10) NOT NULL auto_increment,
    badgeid BIGINT(10) NOT NULL DEFAULT 0,
    issuername VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    issuerurl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    issueremail VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    claimid VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    claimcomment LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    dateissued BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00badgendo_bad_ix (badgeid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines endorsement for badge';
CREATE TABLE pu_00badge_manual_award (
    id BIGINT(10) NOT NULL auto_increment,
    badgeid BIGINT(10) NOT NULL,
    recipientid BIGINT(10) NOT NULL,
    issuerid BIGINT(10) NOT NULL,
    issuerrole BIGINT(10) NOT NULL,
    datemet BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00badgmanuawar_bad_ix (badgeid)
, KEY pu_00badgmanuawar_rec_ix (recipientid)
, KEY pu_00badgmanuawar_iss_ix (issuerid)
, KEY pu_00badgmanuawar_iss2_ix (issuerrole)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Track manual award criteria for badges';
CREATE TABLE pu_00badge_backpack (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    email VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    backpackuid BIGINT(10) NOT NULL,
    autosync TINYINT(1) NOT NULL DEFAULT 0,
    password VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci,
    externalbackpackid BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00badgback_use_ix (userid)
, KEY pu_00badgback_ext_ix (externalbackpackid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines settings for connecting external backpack';
CREATE TABLE pu_00badge_external (
    id BIGINT(10) NOT NULL auto_increment,
    backpackid BIGINT(10) NOT NULL,
    collectionid BIGINT(10) NOT NULL,
    entityid VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00badgexte_bac_ix (backpackid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Setting for external badges display';
CREATE TABLE pu_00badge_external_identifier (
    id BIGINT(10) NOT NULL auto_increment,
    sitebackpackid BIGINT(10) NOT NULL,
    internalid VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    externalid VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    type VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00badgexteiden_sit_ix (sitebackpackid)
, UNIQUE KEY pu_00badgexteiden_sitintex_uix (sitebackpackid, internalid, externalid, type)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Setting for external badges mappings';
CREATE TABLE pu_00badge_related (
    id BIGINT(10) NOT NULL auto_increment,
    badgeid BIGINT(10) NOT NULL DEFAULT 0,
    relatedbadgeid BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00badgrela_bad_ix (badgeid)
, KEY pu_00badgrela_rel_ix (relatedbadgeid)
, UNIQUE KEY pu_00badgrela_badrel_uix (badgeid, relatedbadgeid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines badge related for badges';
CREATE TABLE pu_00badge_external_backpack (
    id BIGINT(10) NOT NULL auto_increment,
    backpackapiurl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    backpackweburl VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    apiversion VARCHAR(12) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1.0',
    sortorder BIGINT(10) NOT NULL DEFAULT 0,
    password VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00badgexteback_bac_uix (backpackapiurl)
, UNIQUE KEY pu_00badgexteback_bac2_uix (backpackweburl)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines settings for site level backpacks that a user can co';
CREATE TABLE pu_00user_devices (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    appid VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    name VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    model VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    platform VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    version VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    pushid VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    uuid VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00userdevi_uuiuse_ix (uuid, userid)
, UNIQUE KEY pu_00userdevi_pususe_uix (pushid, userid)
, KEY pu_00userdevi_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table stores user\'s mobile devices information in order';
CREATE TABLE pu_00user_password_resets (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    timerequested BIGINT(10) NOT NULL,
    timererequested BIGINT(10) NOT NULL DEFAULT 0,
    token VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00userpassrese_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='table tracking password reset confirmation tokens';
CREATE TABLE pu_00lock_db (
    id BIGINT(10) NOT NULL auto_increment,
    resourcekey VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    expires BIGINT(10),
    owner VARCHAR(36) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00lockdb_res_uix (resourcekey)
, KEY pu_00lockdb_exp_ix (expires)
, KEY pu_00lockdb_own_ix (owner)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores active and inactive lock types for db locking method.';
CREATE TABLE pu_00task_scheduled (
    id BIGINT(10) NOT NULL auto_increment,
    component VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    classname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    lastruntime BIGINT(10),
    nextruntime BIGINT(10),
    blocking TINYINT(2) NOT NULL DEFAULT 0,
    minute VARCHAR(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    hour VARCHAR(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    day VARCHAR(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    month VARCHAR(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    dayofweek VARCHAR(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    faildelay BIGINT(10),
    customised TINYINT(2) NOT NULL DEFAULT 0,
    disabled TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00tasksche_cla_uix (classname)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='List of scheduled tasks to be run by cron.';
CREATE TABLE pu_00task_adhoc (
    id BIGINT(10) NOT NULL auto_increment,
    component VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    classname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    nextruntime BIGINT(10) NOT NULL,
    faildelay BIGINT(10),
    customdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    userid BIGINT(10),
    blocking TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00taskadho_nex_ix (nextruntime)
, KEY pu_00taskadho_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='List of adhoc tasks waiting to run.';
CREATE TABLE pu_00messageinbound_handlers (
    id BIGINT(10) NOT NULL auto_increment,
    component VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    classname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    defaultexpiration BIGINT(10) NOT NULL DEFAULT 86400,
    validateaddress TINYINT(1) NOT NULL DEFAULT 1,
    enabled TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00messhand_cla_uix (classname)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Inbound Message Handler definitions.';
CREATE TABLE pu_00messageinbound_datakeys (
    id BIGINT(10) NOT NULL auto_increment,
    handler BIGINT(10) NOT NULL,
    datavalue BIGINT(10) NOT NULL,
    datakey VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL,
    expires BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00messdata_handat_uix (handler, datavalue)
, KEY pu_00messdata_han_ix (handler)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Inbound Message data item secret keys.';
CREATE TABLE pu_00messageinbound_messagelist (
    id BIGINT(10) NOT NULL auto_increment,
    messageid LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    userid BIGINT(10) NOT NULL,
    address LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    timecreated BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00messmess_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='A list of message IDs for existing replies';
CREATE TABLE pu_00competency (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat SMALLINT(4) NOT NULL DEFAULT 0,
    idnumber VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    competencyframeworkid BIGINT(10) NOT NULL,
    parentid BIGINT(10) NOT NULL DEFAULT 0,
    path VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    sortorder BIGINT(10) NOT NULL,
    ruletype VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    ruleoutcome TINYINT(2) NOT NULL DEFAULT 0,
    ruleconfig LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    scaleid BIGINT(10),
    scaleconfiguration LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00comp_comidn_uix (competencyframeworkid, idnumber)
, KEY pu_00comp_rul_ix (ruleoutcome)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table contains the master record of each competency in ';
CREATE TABLE pu_00competency_coursecompsetting (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL,
    pushratingstouserplans TINYINT(2),
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00compcour_cou_uix (courseid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table contains the course specific settings for compete';
CREATE TABLE pu_00competency_framework (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    contextid BIGINT(10) NOT NULL,
    idnumber VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat SMALLINT(4) NOT NULL DEFAULT 0,
    scaleid BIGINT(11),
    scaleconfiguration LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    visible TINYINT(2) NOT NULL DEFAULT 1,
    taxonomies VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00compfram_idn_uix (idnumber)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='List of competency frameworks.';
CREATE TABLE pu_00competency_coursecomp (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL,
    competencyid BIGINT(10) NOT NULL,
    ruleoutcome TINYINT(2) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
    sortorder BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00compcour_courul_ix (courseid, ruleoutcome)
, UNIQUE KEY pu_00compcour_coucom_uix (courseid, competencyid)
, KEY pu_00compcour_cou2_ix (courseid)
, KEY pu_00compcour_com_ix (competencyid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Link a competency to a course.';
CREATE TABLE pu_00competency_plan (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat SMALLINT(4) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL,
    templateid BIGINT(10),
    origtemplateid BIGINT(10),
    status TINYINT(1) NOT NULL,
    duedate BIGINT(10) DEFAULT 0,
    reviewerid BIGINT(10),
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    usermodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00compplan_usesta_ix (userid, status)
, KEY pu_00compplan_tem_ix (templateid)
, KEY pu_00compplan_stadue_ix (status, duedate)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Learning plans';
CREATE TABLE pu_00competency_template (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    contextid BIGINT(10) NOT NULL,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    descriptionformat SMALLINT(4) NOT NULL DEFAULT 0,
    visible TINYINT(2) NOT NULL DEFAULT 1,
    duedate BIGINT(10),
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Learning plan templates.';
CREATE TABLE pu_00competency_templatecomp (
    id BIGINT(10) NOT NULL auto_increment,
    templateid BIGINT(10) NOT NULL,
    competencyid BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
    sortorder BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00comptemp_tem_ix (templateid)
, KEY pu_00comptemp_com_ix (competencyid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Link a competency to a learning plan template.';
CREATE TABLE pu_00competency_templatecohort (
    id BIGINT(10) NOT NULL auto_increment,
    templateid BIGINT(10) NOT NULL,
    cohortid BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00comptemp_tem2_ix (templateid)
, UNIQUE KEY pu_00comptemp_temcoh_uix (templateid, cohortid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Default comment for the table, please edit me';
CREATE TABLE pu_00competency_relatedcomp (
    id BIGINT(10) NOT NULL auto_increment,
    competencyid BIGINT(10) NOT NULL,
    relatedcompetencyid BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10),
    usermodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Related competencies';
CREATE TABLE pu_00competency_usercomp (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    competencyid BIGINT(10) NOT NULL,
    status TINYINT(2) NOT NULL DEFAULT 0,
    reviewerid BIGINT(10),
    proficiency TINYINT(2),
    grade BIGINT(10),
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10),
    usermodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00compuser_usecom_uix (userid, competencyid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='User competencies';
CREATE TABLE pu_00competency_usercompcourse (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    courseid BIGINT(10) NOT NULL,
    competencyid BIGINT(10) NOT NULL,
    proficiency TINYINT(2),
    grade BIGINT(10),
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10),
    usermodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00compuser_usecoucom_uix (userid, courseid, competencyid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='User competencies in a course';
CREATE TABLE pu_00competency_usercompplan (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    competencyid BIGINT(10) NOT NULL,
    planid BIGINT(10) NOT NULL,
    proficiency TINYINT(2),
    grade BIGINT(10),
    sortorder BIGINT(10),
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10),
    usermodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00compuser_usecompla_uix (userid, competencyid, planid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='User competencies plans';
CREATE TABLE pu_00competency_plancomp (
    id BIGINT(10) NOT NULL auto_increment,
    planid BIGINT(10) NOT NULL,
    competencyid BIGINT(10) NOT NULL,
    sortorder BIGINT(10),
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10),
    usermodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00compplan_placom_uix (planid, competencyid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Plan competencies';
CREATE TABLE pu_00competency_evidence (
    id BIGINT(10) NOT NULL auto_increment,
    usercompetencyid BIGINT(10) NOT NULL,
    contextid BIGINT(10) NOT NULL,
    action TINYINT(2) NOT NULL,
    actionuserid BIGINT(10),
    descidentifier VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    desccomponent VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    desca LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    url VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    grade BIGINT(10),
    note LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00compevid_use_ix (usercompetencyid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='The evidence linked to a user competency';
CREATE TABLE pu_00competency_userevidence (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    name VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    descriptionformat TINYINT(1) NOT NULL,
    url LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00compuser_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='The evidence of prior learning';
CREATE TABLE pu_00competency_userevidencecomp (
    id BIGINT(10) NOT NULL auto_increment,
    userevidenceid BIGINT(10) NOT NULL,
    competencyid BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00compuser_use2_ix (userevidenceid)
, UNIQUE KEY pu_00compuser_usecom2_uix (userevidenceid, competencyid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Relationship between user evidence and competencies';
CREATE TABLE pu_00competency_modulecomp (
    id BIGINT(10) NOT NULL auto_increment,
    cmid BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
    sortorder BIGINT(10) NOT NULL,
    competencyid BIGINT(10) NOT NULL,
    ruleoutcome TINYINT(2) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00compmodu_cmirul_ix (cmid, ruleoutcome)
, UNIQUE KEY pu_00compmodu_cmicom_uix (cmid, competencyid)
, KEY pu_00compmodu_cmi_ix (cmid)
, KEY pu_00compmodu_com_ix (competencyid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Link a competency to a module.';
CREATE TABLE pu_00oauth2_endpoint (
    id BIGINT(10) NOT NULL auto_increment,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    url LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    issuerid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00oautendp_iss_ix (issuerid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Describes the named endpoint for an oauth2 service.';
CREATE TABLE pu_00oauth2_issuer (
    id BIGINT(10) NOT NULL auto_increment,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    image LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    baseurl LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    clientid LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    clientsecret LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    loginscopes LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    loginscopesoffline LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    loginparams LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    loginparamsoffline LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    alloweddomains LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    scopessupported LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    enabled TINYINT(2) NOT NULL DEFAULT 1,
    showonloginpage TINYINT(2) NOT NULL DEFAULT 1,
    basicauth TINYINT(2) NOT NULL DEFAULT 0,
    sortorder BIGINT(10) NOT NULL,
    requireconfirmation TINYINT(2) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Details for an oauth 2 connect identity issuer.';
CREATE TABLE pu_00oauth2_system_account (
    id BIGINT(10) NOT NULL auto_increment,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
    issuerid BIGINT(10) NOT NULL,
    refreshtoken LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    grantedscopes LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    email LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    username LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00oautsystacco_iss_uix (issuerid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stored details used to get an access token as a system user ';
CREATE TABLE pu_00oauth2_user_field_mapping (
    id BIGINT(10) NOT NULL auto_increment,
    timemodified BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
    issuerid BIGINT(10) NOT NULL,
    externalfield VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    internalfield VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00oautuserfielmapp_iss_ix (issuerid)
, UNIQUE KEY pu_00oautuserfielmapp_issi_uix (issuerid, internalfield)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Mapping of oauth user fields to moodle fields.';
CREATE TABLE pu_00course_completion_defaults (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL,
    module BIGINT(10) NOT NULL,
    completion TINYINT(1) NOT NULL DEFAULT 0,
    completionview TINYINT(1) NOT NULL DEFAULT 0,
    completionusegrade TINYINT(1) NOT NULL DEFAULT 0,
    completionexpected BIGINT(10) NOT NULL DEFAULT 0,
    customrules LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00courcompdefa_coumod_uix (course, module)
, KEY pu_00courcompdefa_mod_ix (module)
, KEY pu_00courcompdefa_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Totara: Not used (MDL-58138). Default settings for activitie';
CREATE TABLE pu_00oauth2_access_token (
    id BIGINT(10) NOT NULL auto_increment,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    usermodified BIGINT(10) NOT NULL,
    issuerid BIGINT(10) NOT NULL,
    token LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    expires BIGINT(10) NOT NULL,
    scope LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00oautaccetoke_iss_uix (issuerid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores access tokens for system accounts in order to be able';
CREATE TABLE pu_00search_index_requests (
    id BIGINT(10) NOT NULL auto_increment,
    contextid BIGINT(10) NOT NULL,
    searcharea VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timerequested BIGINT(10) NOT NULL,
    partialarea VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    partialtime BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00searinderequ_con_ix (contextid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Records requests for (re)indexing of specific contexts. Entr';
ALTER TABLE pu_00tenant ADD CONSTRAINT pu_00tenant_cohortid_fk FOREIGN KEY (cohortid) REFERENCES pu_00cohort (id) ON DELETE RESTRICT ON UPDATE RESTRICT;
CREATE UNIQUE INDEX pu_00tena_coh_uix ON pu_00tenant (cohortid);
ALTER TABLE pu_00course AUTO_INCREMENT = 2;
CREATE TABLE pu_00course_info_data (
    id BIGINT(10) NOT NULL auto_increment,
    fieldid BIGINT(10) NOT NULL,
    courseid BIGINT(10) NOT NULL,
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00courinfodata_fiecou_uix (fieldid, courseid)
, KEY pu_00courinfodata_fie_ix (fieldid)
, KEY pu_00courinfodata_cou_ix (courseid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Custom course fields data';
CREATE TABLE pu_00course_info_data_param (
    id BIGINT(10) NOT NULL auto_increment,
    dataid BIGINT(10) NOT NULL,
    value VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00courinfodatapara_val_ix (value)
, KEY pu_00courinfodatapara_dat_ix (dataid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Custom course fields data parameters';
CREATE TABLE pu_00course_info_field (
    id BIGINT(10) NOT NULL auto_increment,
    fullname LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    datatype VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    sortorder BIGINT(10) NOT NULL,
    hidden TINYINT(1) NOT NULL,
    locked TINYINT(1) NOT NULL,
    required TINYINT(1) NOT NULL,
    forceunique TINYINT(1) NOT NULL,
    defaultdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param5 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Custom course fields';
CREATE TABLE pu_00gap_aspirational (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    positionid BIGINT(10) NOT NULL,
    timecreated BIGINT(18) NOT NULL,
    timemodified BIGINT(18) NOT NULL,
    usermodified BIGINT(18) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gapaspi_use_ix (userid)
, KEY pu_00gapaspi_pos_ix (positionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Aspirational positions';
CREATE TABLE pu_00job_assignment (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(18) NOT NULL,
    fullname LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    idnumber VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    startdate BIGINT(18),
    enddate BIGINT(18),
    timecreated BIGINT(18) NOT NULL,
    timemodified BIGINT(18) NOT NULL,
    usermodified BIGINT(18) NOT NULL,
    positionid BIGINT(18),
    positionassignmentdate BIGINT(18) NOT NULL,
    organisationid BIGINT(18),
    managerjaid BIGINT(18),
    managerjapath VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    tempmanagerjaid BIGINT(18),
    tempmanagerexpirydate BIGINT(18),
    appraiserid BIGINT(10),
    sortorder BIGINT(10) NOT NULL,
    totarasync TINYINT(1) NOT NULL DEFAULT 0,
    synctimemodified BIGINT(18) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00jobassi_useidn_uix (userid, idnumber)
, UNIQUE KEY pu_00jobassi_usesor_uix (userid, sortorder)
, KEY pu_00jobassi_use_ix (userid)
, KEY pu_00jobassi_use2_ix (usermodified)
, KEY pu_00jobassi_pos_ix (positionid)
, KEY pu_00jobassi_org_ix (organisationid)
, KEY pu_00jobassi_man_ix (managerjaid)
, KEY pu_00jobassi_tem_ix (tempmanagerjaid)
, KEY pu_00jobassi_app_ix (appraiserid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Assignment of a job to a user';
CREATE TABLE pu_00reminder (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL,
    title LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    type VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci,
    config LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL,
    timemodified BIGINT(10) NOT NULL,
    modifierid BIGINT(10) NOT NULL,
    deleted TINYINT(1) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00remi_cou_ix (courseid)
, KEY pu_00remi_typ_ix (type)
, KEY pu_00remi_del_ix (deleted)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Totara course reminders';
CREATE TABLE pu_00reminder_message (
    id BIGINT(10) NOT NULL auto_increment,
    reminderid BIGINT(10) NOT NULL,
    type VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci,
    period BIGINT(10) NOT NULL,
    copyto LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    subject LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    message LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    deleted TINYINT(1) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00remimess_rem_ix (reminderid)
, KEY pu_00remimess_typ_ix (type)
, KEY pu_00remimess_del_ix (deleted)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Totara course reminder messages';
CREATE TABLE pu_00reminder_sent (
    id BIGINT(10) NOT NULL auto_increment,
    reminderid BIGINT(10) NOT NULL,
    messageid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    timesent BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00remisent_rem_ix (reminderid)
, KEY pu_00remisent_mes_ix (messageid)
, KEY pu_00remisent_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Totara course reminders log of messages sent';
CREATE TABLE pu_00totara_navigation (
    id BIGINT(10) NOT NULL auto_increment,
    parentid BIGINT(10) NOT NULL DEFAULT 0,
    title VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    url VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    classname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    sortorder BIGINT(10) NOT NULL,
    depth TINYINT(1) NOT NULL DEFAULT 1,
    path VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci,
    custom TINYINT(1) NOT NULL DEFAULT 1,
    customtitle TINYINT(1) NOT NULL DEFAULT 1,
    visibility TINYINT(1) NOT NULL DEFAULT 0,
    visibilityold TINYINT(1),
    targetattr VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00totanavi_par_ix (parentid)
, KEY pu_00totanavi_sor_ix (sortorder)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Totara navigation menu';
CREATE TABLE pu_00totara_navigation_settings (
    id BIGINT(10) NOT NULL auto_increment,
    itemid BIGINT(10) NOT NULL,
    type VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00totanavisett_ite_ix (itemid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Settings for navigation menu items';
CREATE TABLE pu_00persistent_login (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    cookie VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timecreated BIGINT(10) NOT NULL,
    timeautologin BIGINT(10),
    useragent LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    sid VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    lastaccess BIGINT(10),
    lastip VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00perslogi_coo_uix (cookie)
, UNIQUE KEY pu_00perslogi_sid_uix (sid)
, KEY pu_00perslogi_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Persistent user logins';
CREATE TABLE pu_00backup_trusted_files (
    id BIGINT(10) NOT NULL auto_increment,
    contenthash VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    filesize BIGINT(10) NOT NULL,
    backupid VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timeadded BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00backtrusfile_con_uix (contenthash)
, KEY pu_00backtrusfile_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='List of files that are trusted';
CREATE TABLE pu_00quickaccess_preferences (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quicpref_use_ix (userid)
, UNIQUE KEY pu_00quicpref_usenam_uix (userid, name)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores user preferences for the quick access menu';
CREATE TABLE pu_00totara_core_course_vis_map (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL,
    roleid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00totacorecourvismap_co_uix (courseid, roleid)
, KEY pu_00totacorecourvismap_cou_ix (courseid)
, KEY pu_00totacorecourvismap_rol_ix (roleid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Course view hidden capability to role map';
CREATE TABLE pu_00totara_core_program_vis_map (
    id BIGINT(10) NOT NULL auto_increment,
    programid BIGINT(10) NOT NULL,
    roleid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00totacoreprogvismap_pr_uix (programid, roleid)
, KEY pu_00totacoreprogvismap_pro_ix (programid)
, KEY pu_00totacoreprogvismap_rol_ix (roleid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Program view hidden capability to role map';
CREATE TABLE pu_00totara_core_certification_vis_map (
    id BIGINT(10) NOT NULL auto_increment,
    programid BIGINT(10) NOT NULL,
    roleid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00totacorecertvismap_pr_uix (programid, roleid)
, KEY pu_00totacorecertvismap_pro_ix (programid)
, KEY pu_00totacorecertvismap_rol_ix (roleid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Certification view hidden capability to role map';
ALTER TABLE pu_00course MODIFY COLUMN fullname VARCHAR(1333) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE pu_00course_request MODIFY COLUMN fullname VARCHAR(1333) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE pu_00course_request DROP INDEX pu_00courrequ_sho_ix;
ALTER TABLE pu_00course_request MODIFY COLUMN shortname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
CREATE INDEX pu_00courrequ_sho2_ix ON pu_00course_request (shortname);
CREATE TABLE pu_00question_calculated (
    id BIGINT(10) NOT NULL auto_increment,
    question BIGINT(10) NOT NULL DEFAULT 0,
    answer BIGINT(10) NOT NULL DEFAULT 0,
    tolerance VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0.0',
    tolerancetype BIGINT(10) NOT NULL DEFAULT 1,
    correctanswerlength BIGINT(10) NOT NULL DEFAULT 2,
    correctanswerformat BIGINT(10) NOT NULL DEFAULT 2,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quescalc_ans_ix (answer)
, KEY pu_00quescalc_que_ix (question)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Options for questions of type calculated';
CREATE TABLE pu_00question_calculated_options (
    id BIGINT(10) NOT NULL auto_increment,
    question BIGINT(10) NOT NULL DEFAULT 0,
    synchronize TINYINT(2) NOT NULL DEFAULT 0,
    single SMALLINT(4) NOT NULL DEFAULT 0,
    shuffleanswers SMALLINT(4) NOT NULL DEFAULT 0,
    correctfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    correctfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    partiallycorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    partiallycorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    incorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    incorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    answernumbering VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'abc',
    shownumcorrect TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quescalcopti_que_ix (question)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Options for questions of type calculated';
CREATE TABLE pu_00question_dataset_definitions (
    id BIGINT(10) NOT NULL auto_increment,
    category BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    type BIGINT(10) NOT NULL DEFAULT 0,
    options VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    itemcount BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesdatadefi_cat_ix (category)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Organises and stores properties for dataset items';
CREATE TABLE pu_00question_dataset_items (
    id BIGINT(10) NOT NULL auto_increment,
    definition BIGINT(10) NOT NULL DEFAULT 0,
    itemnumber BIGINT(10) NOT NULL DEFAULT 0,
    value VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesdataitem_def_ix (definition)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Individual dataset items';
CREATE TABLE pu_00question_datasets (
    id BIGINT(10) NOT NULL auto_increment,
    question BIGINT(10) NOT NULL DEFAULT 0,
    datasetdefinition BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesdata_quedat_ix (question, datasetdefinition)
, KEY pu_00quesdata_que_ix (question)
, KEY pu_00quesdata_dat_ix (datasetdefinition)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Many-many relation between questions and dataset definitions';
CREATE TABLE pu_00qtype_ddimageortext (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    shuffleanswers SMALLINT(4) NOT NULL DEFAULT 1,
    correctfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    correctfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    partiallycorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    partiallycorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    incorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    incorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    shownumcorrect TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00qtypddim_que_ix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines drag and drop (text or images onto a background imag';
CREATE TABLE pu_00qtype_ddimageortext_drops (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    no BIGINT(10) NOT NULL DEFAULT 0,
    xleft BIGINT(10) NOT NULL DEFAULT 0,
    ytop BIGINT(10) NOT NULL DEFAULT 0,
    choice BIGINT(10) NOT NULL DEFAULT 0,
    label LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00qtypddimdrop_que_ix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Drop boxes';
CREATE TABLE pu_00qtype_ddimageortext_drags (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    no BIGINT(10) NOT NULL DEFAULT 0,
    draggroup BIGINT(10) NOT NULL DEFAULT 0,
    infinite SMALLINT(4) NOT NULL DEFAULT 0,
    label LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00qtypddimdrag_que_ix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Images to drag. Actual file names are not stored here we use';
CREATE TABLE pu_00qtype_ddmarker (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    shuffleanswers SMALLINT(4) NOT NULL DEFAULT 1,
    correctfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    correctfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    partiallycorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    partiallycorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    incorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    incorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    shownumcorrect TINYINT(2) NOT NULL DEFAULT 0,
    showmisplaced SMALLINT(4) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00qtypddma_que_ix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines drag and drop (text or images onto a background imag';
CREATE TABLE pu_00qtype_ddmarker_drops (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    no BIGINT(10) NOT NULL DEFAULT 0,
    shape VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    coords LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    choice BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00qtypddmadrop_que_ix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='drop regions';
CREATE TABLE pu_00qtype_ddmarker_drags (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    no BIGINT(10) NOT NULL DEFAULT 0,
    label LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    infinite SMALLINT(4) NOT NULL DEFAULT 0,
    noofdrags BIGINT(10) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00qtypddmadrag_que_ix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Labels for markers to drag.';
CREATE TABLE pu_00question_ddwtos (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    shuffleanswers SMALLINT(4) NOT NULL DEFAULT 1,
    correctfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    correctfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    partiallycorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    partiallycorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    incorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    incorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    shownumcorrect TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesddwt_que_ix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines drag and drop (words into sentences) questions';
CREATE TABLE pu_00qtype_essay_options (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL,
    responseformat VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'editor',
    responserequired TINYINT(2) NOT NULL DEFAULT 1,
    responsefieldlines SMALLINT(4) NOT NULL DEFAULT 15,
    attachments SMALLINT(4) NOT NULL DEFAULT 0,
    attachmentsrequired SMALLINT(4) NOT NULL DEFAULT 0,
    graderinfo LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    graderinfoformat SMALLINT(4) NOT NULL DEFAULT 0,
    responsetemplate LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    responsetemplateformat SMALLINT(4) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00qtypessaopti_que_uix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Extra options for essay questions.';
CREATE TABLE pu_00question_gapselect (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    shuffleanswers SMALLINT(4) NOT NULL DEFAULT 1,
    correctfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    correctfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    partiallycorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    partiallycorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    incorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    incorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    shownumcorrect TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesgaps_que_ix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines select missing words questions';
CREATE TABLE pu_00qtype_match_options (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    shuffleanswers SMALLINT(4) NOT NULL DEFAULT 1,
    correctfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    correctfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    partiallycorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    partiallycorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    incorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    incorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    shownumcorrect TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00qtypmatcopti_que_uix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines the question-type specific options for matching ques';
CREATE TABLE pu_00qtype_match_subquestions (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    questiontext LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    questiontextformat TINYINT(2) NOT NULL DEFAULT 0,
    answertext VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00qtypmatcsubq_que_ix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='The subquestions that make up a matching question';
CREATE TABLE pu_00question_multianswer (
    id BIGINT(10) NOT NULL auto_increment,
    question BIGINT(10) NOT NULL DEFAULT 0,
    sequence LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesmult_que_ix (question)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Options for multianswer questions';
CREATE TABLE pu_00qtype_multichoice_options (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    layout SMALLINT(4) NOT NULL DEFAULT 0,
    single SMALLINT(4) NOT NULL DEFAULT 0,
    shuffleanswers SMALLINT(4) NOT NULL DEFAULT 1,
    correctfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    correctfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    partiallycorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    partiallycorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    incorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    incorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    answernumbering VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'abc',
    shownumcorrect TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00qtypmultopti_que_uix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Options for multiple choice questions';
CREATE TABLE pu_00question_numerical (
    id BIGINT(10) NOT NULL auto_increment,
    question BIGINT(10) NOT NULL DEFAULT 0,
    answer BIGINT(10) NOT NULL DEFAULT 0,
    tolerance VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0.0',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesnume_ans_ix (answer)
, KEY pu_00quesnume_que_ix (question)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Options for numerical questions.';
CREATE TABLE pu_00question_numerical_options (
    id BIGINT(10) NOT NULL auto_increment,
    question BIGINT(10) NOT NULL DEFAULT 0,
    showunits SMALLINT(4) NOT NULL DEFAULT 0,
    unitsleft SMALLINT(4) NOT NULL DEFAULT 0,
    unitgradingtype SMALLINT(4) NOT NULL DEFAULT 0,
    unitpenalty NUMERIC(12,7) NOT NULL DEFAULT 0.1,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00quesnumeopti_que_ix (question)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Options for questions of type numerical This table is also u';
CREATE TABLE pu_00question_numerical_units (
    id BIGINT(10) NOT NULL auto_increment,
    question BIGINT(10) NOT NULL DEFAULT 0,
    multiplier NUMERIC(40,20) NOT NULL DEFAULT 1.00000000000000000000,
    unit VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00quesnumeunit_queuni_uix (question, unit)
, KEY pu_00quesnumeunit_que_ix (question)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Optional unit options for numerical questions. This table is';
CREATE TABLE pu_00qtype_randomsamatch_options (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    choose BIGINT(10) NOT NULL DEFAULT 4,
    subcats TINYINT(2) NOT NULL DEFAULT 1,
    correctfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    correctfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    partiallycorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    partiallycorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    incorrectfeedback LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    incorrectfeedbackformat TINYINT(2) NOT NULL DEFAULT 0,
    shownumcorrect TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00qtyprandopti_que_uix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Info about a random short-answer matching question';
CREATE TABLE pu_00qtype_shortanswer_options (
    id BIGINT(10) NOT NULL auto_increment,
    questionid BIGINT(10) NOT NULL DEFAULT 0,
    usecase TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00qtypshoropti_que_uix (questionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Options for short answer questions';
CREATE TABLE pu_00question_truefalse (
    id BIGINT(10) NOT NULL auto_increment,
    question BIGINT(10) NOT NULL DEFAULT 0,
    trueanswer BIGINT(10) NOT NULL DEFAULT 0,
    falseanswer BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00questrue_que_ix (question)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Options for True-False questions';
CREATE TABLE pu_00assign (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    alwaysshowdescription TINYINT(2) NOT NULL DEFAULT 0,
    nosubmissions TINYINT(2) NOT NULL DEFAULT 0,
    submissiondrafts TINYINT(2) NOT NULL DEFAULT 0,
    sendnotifications TINYINT(2) NOT NULL DEFAULT 0,
    sendlatenotifications TINYINT(2) NOT NULL DEFAULT 0,
    duedate BIGINT(10) NOT NULL DEFAULT 0,
    allowsubmissionsfromdate BIGINT(10) NOT NULL DEFAULT 0,
    grade BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    requiresubmissionstatement TINYINT(2) NOT NULL DEFAULT 0,
    completionsubmit TINYINT(2) NOT NULL DEFAULT 0,
    cutoffdate BIGINT(10) NOT NULL DEFAULT 0,
    gradingduedate BIGINT(10) NOT NULL DEFAULT 0,
    teamsubmission TINYINT(2) NOT NULL DEFAULT 0,
    requireallteammemberssubmit TINYINT(2) NOT NULL DEFAULT 0,
    teamsubmissiongroupingid BIGINT(10) NOT NULL DEFAULT 0,
    blindmarking TINYINT(2) NOT NULL DEFAULT 0,
    revealidentities TINYINT(2) NOT NULL DEFAULT 0,
    attemptreopenmethod VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'none',
    maxattempts MEDIUMINT(6) NOT NULL DEFAULT -1,
    markingworkflow TINYINT(2) NOT NULL DEFAULT 0,
    markingallocation TINYINT(2) NOT NULL DEFAULT 0,
    sendstudentnotifications TINYINT(2) NOT NULL DEFAULT 1,
    preventsubmissionnotingroup TINYINT(2) NOT NULL DEFAULT 0,
    completionpass TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00assi_cou_ix (course)
, KEY pu_00assi_tea_ix (teamsubmissiongroupingid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table saves information about an instance of mod_assign';
CREATE TABLE pu_00assign_submission (
    id BIGINT(10) NOT NULL auto_increment,
    assignment BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    status VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci,
    groupid BIGINT(10) NOT NULL DEFAULT 0,
    attemptnumber BIGINT(10) NOT NULL DEFAULT 0,
    latest TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00assisubm_use_ix (userid)
, KEY pu_00assisubm_att_ix (attemptnumber)
, UNIQUE KEY pu_00assisubm_assusegroatt_uix (assignment, userid, groupid, attemptnumber)
, KEY pu_00assisubm_assusegrolat_ix (assignment, userid, groupid, latest)
, KEY pu_00assisubm_ass_ix (assignment)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='This table keeps information about student interactions with';
CREATE TABLE pu_00assign_grades (
    id BIGINT(10) NOT NULL auto_increment,
    assignment BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    grader BIGINT(10) NOT NULL DEFAULT 0,
    grade NUMERIC(10,5) DEFAULT 0,
    attemptnumber BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00assigrad_use_ix (userid)
, KEY pu_00assigrad_att_ix (attemptnumber)
, UNIQUE KEY pu_00assigrad_assuseatt_uix (assignment, userid, attemptnumber)
, KEY pu_00assigrad_ass_ix (assignment)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Grading information about a single assignment submission.';
CREATE TABLE pu_00assign_plugin_config (
    id BIGINT(10) NOT NULL auto_increment,
    assignment BIGINT(10) NOT NULL DEFAULT 0,
    plugin VARCHAR(28) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    subtype VARCHAR(28) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    name VARCHAR(28) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00assiplugconf_plu_ix (plugin)
, KEY pu_00assiplugconf_sub_ix (subtype)
, KEY pu_00assiplugconf_nam_ix (name)
, KEY pu_00assiplugconf_ass_ix (assignment)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Config data for an instance of a plugin in an assignment.';
CREATE TABLE pu_00assign_user_mapping (
    id BIGINT(10) NOT NULL auto_increment,
    assignment BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00assiusermapp_ass_ix (assignment)
, KEY pu_00assiusermapp_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Map an assignment specific id number to a user';
CREATE TABLE pu_00assign_user_flags (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    assignment BIGINT(10) NOT NULL DEFAULT 0,
    locked BIGINT(10) NOT NULL DEFAULT 0,
    mailed SMALLINT(4) NOT NULL DEFAULT 0,
    extensionduedate BIGINT(10) NOT NULL DEFAULT 0,
    workflowstate VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci,
    allocatedmarker BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00assiuserflag_mai_ix (mailed)
, KEY pu_00assiuserflag_use_ix (userid)
, KEY pu_00assiuserflag_ass_ix (assignment)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='List of flags that can be set for a single user in a single ';
CREATE TABLE pu_00assign_overrides (
    id BIGINT(10) NOT NULL auto_increment,
    assignid BIGINT(10) NOT NULL DEFAULT 0,
    groupid BIGINT(10),
    userid BIGINT(10),
    sortorder BIGINT(10),
    allowsubmissionsfromdate BIGINT(10),
    duedate BIGINT(10),
    cutoffdate BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00assiover_ass_ix (assignid)
, KEY pu_00assiover_gro_ix (groupid)
, KEY pu_00assiover_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='The overrides to assign settings.';
CREATE TABLE pu_00book (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    numbering SMALLINT(4) NOT NULL DEFAULT 0,
    navstyle SMALLINT(4) NOT NULL DEFAULT 1,
    customtitles TINYINT(2) NOT NULL DEFAULT 0,
    revision BIGINT(10) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines book';
CREATE TABLE pu_00book_chapters (
    id BIGINT(10) NOT NULL auto_increment,
    bookid BIGINT(10) NOT NULL DEFAULT 0,
    pagenum BIGINT(10) NOT NULL DEFAULT 0,
    subchapter BIGINT(10) NOT NULL DEFAULT 0,
    title VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    content LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    contentformat SMALLINT(4) NOT NULL DEFAULT 0,
    hidden TINYINT(2) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    importsrc VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines book_chapters';
CREATE TABLE pu_00certificate (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    emailteachers TINYINT(1) NOT NULL DEFAULT 0,
    emailothers LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    savecert TINYINT(1) NOT NULL DEFAULT 0,
    reportcert TINYINT(1) NOT NULL DEFAULT 0,
    delivery SMALLINT(3) NOT NULL DEFAULT 0,
    requiredtime BIGINT(10) NOT NULL DEFAULT 0,
    certificatetype VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    orientation VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    borderstyle VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0',
    bordercolor VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0',
    printwmark VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0',
    printdate BIGINT(10) NOT NULL DEFAULT 0,
    datefmt BIGINT(10) NOT NULL DEFAULT 0,
    printnumber TINYINT(1) NOT NULL DEFAULT 0,
    printgrade BIGINT(10) NOT NULL DEFAULT 0,
    gradefmt BIGINT(10) NOT NULL DEFAULT 0,
    printoutcome BIGINT(10) NOT NULL DEFAULT 0,
    printhours VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    printteacher BIGINT(10) NOT NULL DEFAULT 0,
    customtext LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    printsignature VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0',
    printseal VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0',
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Defines certificates';
CREATE TABLE pu_00certificate_issues (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    certificateid BIGINT(10) NOT NULL DEFAULT 0,
    code VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Info about issued certificates';
CREATE TABLE pu_00certificate_issues_history (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    certificateid BIGINT(10) NOT NULL DEFAULT 0,
    code VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timecompleted BIGINT(10),
    grade VARCHAR(300) CHARACTER SET utf8 COLLATE utf8_general_ci,
    outcome VARCHAR(300) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timearchived BIGINT(10) NOT NULL,
    idarchived BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00certissuhist_cer_ix (certificateid)
, KEY pu_00certissuhist_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Archived user certificates for Totara';
CREATE TABLE pu_00chat (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    keepdays BIGINT(11) NOT NULL DEFAULT 0,
    studentlogs SMALLINT(4) NOT NULL DEFAULT 0,
    chattime BIGINT(10) NOT NULL DEFAULT 0,
    schedule SMALLINT(4) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00chat_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Each of these is a chat room';
CREATE TABLE pu_00chat_messages (
    id BIGINT(10) NOT NULL auto_increment,
    chatid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    groupid BIGINT(10) NOT NULL DEFAULT 0,
    issystem TINYINT(1) NOT NULL DEFAULT 0,
    message LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    timestamp BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00chatmess_use_ix (userid)
, KEY pu_00chatmess_gro_ix (groupid)
, KEY pu_00chatmess_timcha_ix (timestamp, chatid)
, KEY pu_00chatmess_cha_ix (chatid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores all the actual chat messages';
CREATE TABLE pu_00chat_messages_current (
    id BIGINT(10) NOT NULL auto_increment,
    chatid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    groupid BIGINT(10) NOT NULL DEFAULT 0,
    issystem TINYINT(1) NOT NULL DEFAULT 0,
    message LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    timestamp BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00chatmesscurr_use_ix (userid)
, KEY pu_00chatmesscurr_gro_ix (groupid)
, KEY pu_00chatmesscurr_timcha_ix (timestamp, chatid)
, KEY pu_00chatmesscurr_cha_ix (chatid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores current session';
CREATE TABLE pu_00chat_users (
    id BIGINT(10) NOT NULL auto_increment,
    chatid BIGINT(11) NOT NULL DEFAULT 0,
    userid BIGINT(11) NOT NULL DEFAULT 0,
    groupid BIGINT(11) NOT NULL DEFAULT 0,
    version VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    ip VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    firstping BIGINT(10) NOT NULL DEFAULT 0,
    lastping BIGINT(10) NOT NULL DEFAULT 0,
    lastmessageping BIGINT(10) NOT NULL DEFAULT 0,
    sid VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    course BIGINT(10) NOT NULL DEFAULT 0,
    lang VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00chatuser_use_ix (userid)
, KEY pu_00chatuser_las_ix (lastping)
, KEY pu_00chatuser_gro_ix (groupid)
, KEY pu_00chatuser_cha_ix (chatid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Keeps track of which users are in which chat rooms';
CREATE TABLE pu_00choice (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    publish TINYINT(2) NOT NULL DEFAULT 0,
    showresults TINYINT(2) NOT NULL DEFAULT 0,
    display SMALLINT(4) NOT NULL DEFAULT 0,
    allowupdate TINYINT(2) NOT NULL DEFAULT 0,
    allowmultiple TINYINT(2) NOT NULL DEFAULT 0,
    showunanswered TINYINT(2) NOT NULL DEFAULT 0,
    includeinactive TINYINT(2) NOT NULL DEFAULT 1,
    limitanswers TINYINT(2) NOT NULL DEFAULT 0,
    timeopen BIGINT(10) NOT NULL DEFAULT 0,
    timeclose BIGINT(10) NOT NULL DEFAULT 0,
    showpreview TINYINT(2) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    completionsubmit TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00choi_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Available choices are stored here';
CREATE TABLE pu_00choice_options (
    id BIGINT(10) NOT NULL auto_increment,
    choiceid BIGINT(10) NOT NULL DEFAULT 0,
    text LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    maxanswers BIGINT(10) DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00choiopti_cho_ix (choiceid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='available options to choice';
CREATE TABLE pu_00choice_answers (
    id BIGINT(10) NOT NULL auto_increment,
    choiceid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    optionid BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00choiansw_use_ix (userid)
, KEY pu_00choiansw_cho_ix (choiceid)
, KEY pu_00choiansw_opt_ix (optionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='choices performed by users';
CREATE TABLE pu_00data (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    comments SMALLINT(4) NOT NULL DEFAULT 0,
    timeavailablefrom BIGINT(10) NOT NULL DEFAULT 0,
    timeavailableto BIGINT(10) NOT NULL DEFAULT 0,
    timeviewfrom BIGINT(10) NOT NULL DEFAULT 0,
    timeviewto BIGINT(10) NOT NULL DEFAULT 0,
    requiredentries INT(8) NOT NULL DEFAULT 0,
    requiredentriestoview INT(8) NOT NULL DEFAULT 0,
    maxentries INT(8) NOT NULL DEFAULT 0,
    rssarticles SMALLINT(4) NOT NULL DEFAULT 0,
    singletemplate LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    listtemplate LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    listtemplateheader LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    listtemplatefooter LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    addtemplate LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    rsstemplate LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    rsstitletemplate LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    csstemplate LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    jstemplate LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    asearchtemplate LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    approval SMALLINT(4) NOT NULL DEFAULT 0,
    manageapproved SMALLINT(4) NOT NULL DEFAULT 1,
    scale BIGINT(10) NOT NULL DEFAULT 0,
    assessed BIGINT(10) NOT NULL DEFAULT 0,
    assesstimestart BIGINT(10) NOT NULL DEFAULT 0,
    assesstimefinish BIGINT(10) NOT NULL DEFAULT 0,
    defaultsort BIGINT(10) NOT NULL DEFAULT 0,
    defaultsortdir SMALLINT(4) NOT NULL DEFAULT 0,
    editany SMALLINT(4) NOT NULL DEFAULT 0,
    notification BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    config LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    completionentries BIGINT(10) DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00data_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='all database activities';
CREATE TABLE pu_00data_fields (
    id BIGINT(10) NOT NULL auto_increment,
    dataid BIGINT(10) NOT NULL DEFAULT 0,
    type VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    required TINYINT(1) NOT NULL DEFAULT 0,
    param1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param5 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param6 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param7 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param8 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param9 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param10 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00datafiel_typdat_ix (type, dataid)
, KEY pu_00datafiel_dat_ix (dataid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='every field available';
CREATE TABLE pu_00data_records (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    groupid BIGINT(10) NOT NULL DEFAULT 0,
    dataid BIGINT(10) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    approved SMALLINT(4) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00datareco_dat_ix (dataid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='every record introduced';
CREATE TABLE pu_00data_content (
    id BIGINT(10) NOT NULL auto_increment,
    fieldid BIGINT(10) NOT NULL DEFAULT 0,
    recordid BIGINT(10) NOT NULL DEFAULT 0,
    content LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    content1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    content2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    content3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    content4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00datacont_rec_ix (recordid)
, KEY pu_00datacont_fie_ix (fieldid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='the content introduced in each record/fields';
CREATE TABLE pu_00facetoface (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    introformat TINYINT(2) NOT NULL DEFAULT 0,
    thirdparty VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    thirdpartywaitlist TINYINT(1) NOT NULL DEFAULT 0,
    display BIGINT(10) NOT NULL DEFAULT 0,
    timecreated BIGINT(18) NOT NULL DEFAULT 0,
    timemodified BIGINT(18) NOT NULL DEFAULT 0,
    shortname VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci,
    showoncalendar TINYINT(1) NOT NULL DEFAULT 1,
    usercalentry TINYINT(1) NOT NULL DEFAULT 1,
    multiplesessions TINYINT(1) DEFAULT 0,
    completionstatusrequired VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    managerreserve SMALLINT(4) DEFAULT 0,
    maxmanagerreserves INT(7) DEFAULT 1,
    reservecanceldays INT(7) DEFAULT 1,
    reservedays INT(7) DEFAULT 2,
    declareinterest TINYINT(1) NOT NULL DEFAULT 0,
    interestonlyiffull TINYINT(1) NOT NULL DEFAULT 0,
    allowcancellationsdefault TINYINT(1) NOT NULL DEFAULT 1,
    cancellationscutoffdefault BIGINT(10) NOT NULL DEFAULT 86400,
    selectjobassignmentonsignup TINYINT(1) NOT NULL DEFAULT 0,
    forceselectjobassignment TINYINT(1) NOT NULL DEFAULT 0,
    approvaltype BIGINT(10) NOT NULL DEFAULT 0,
    approvalrole BIGINT(10),
    approvalterms LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    approvaladmins VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    multisignupfully TINYINT(1) NOT NULL DEFAULT 0,
    multisignuppartly TINYINT(1) NOT NULL DEFAULT 0,
    multisignupnoshow TINYINT(1) NOT NULL DEFAULT 0,
    multisignupunableto TINYINT(1) NOT NULL DEFAULT 0,
    multisignupmaximum BIGINT(10) NOT NULL DEFAULT 0,
    decluttersessiontable TINYINT(1) NOT NULL DEFAULT 0,
    waitlistautoclean TINYINT(1) NOT NULL DEFAULT 0,
    sessionattendance TINYINT(1) NOT NULL DEFAULT 0,
    attendancetime TINYINT(1) NOT NULL DEFAULT 3,
    eventgradingmanual TINYINT(1) NOT NULL DEFAULT 0,
    eventgradingmethod SMALLINT(4) NOT NULL DEFAULT 0,
    completionpass TINYINT(1) NOT NULL DEFAULT 0,
    completiondelay INT(7),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00face_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Each seminar activity has an entry here';
CREATE TABLE pu_00facetoface_session_roles (
    id BIGINT(10) NOT NULL auto_increment,
    sessionid BIGINT(10) NOT NULL,
    roleid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facesessrole_ses_ix (sessionid)
, KEY pu_00facesessrole_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Users with a trainer-like role in a seminar event';
CREATE TABLE pu_00facetoface_sessions (
    id BIGINT(10) NOT NULL auto_increment,
    facetoface BIGINT(10) NOT NULL DEFAULT 0,
    capacity BIGINT(10) NOT NULL DEFAULT 0,
    allowoverbook TINYINT(1) NOT NULL DEFAULT 0,
    waitlisteveryone TINYINT(1) NOT NULL DEFAULT 0,
    details LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    normalcost VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0',
    discountcost VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0',
    allowcancellations TINYINT(1) NOT NULL DEFAULT 1,
    cancellationcutoff BIGINT(10) NOT NULL DEFAULT 86400,
    timecreated BIGINT(20) NOT NULL DEFAULT 0,
    timemodified BIGINT(20) NOT NULL DEFAULT 0,
    usermodified BIGINT(20) NOT NULL,
    selfapproval TINYINT(1) NOT NULL DEFAULT 0,
    mincapacity BIGINT(10) NOT NULL DEFAULT 0,
    cutoff BIGINT(10) DEFAULT 86400,
    sendcapacityemail TINYINT(1) DEFAULT 0,
    registrationtimestart BIGINT(10) NOT NULL DEFAULT 0,
    registrationtimefinish BIGINT(10) NOT NULL DEFAULT 0,
    cancelledstatus TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facesess_fac_ix (facetoface)
, KEY pu_00facesess_use_ix (usermodified)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Describes seminar events';
CREATE TABLE pu_00facetoface_sessions_dates (
    id BIGINT(10) NOT NULL auto_increment,
    sessionid BIGINT(10) NOT NULL DEFAULT 0,
    sessiontimezone VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timestart BIGINT(18) NOT NULL DEFAULT 0,
    timefinish BIGINT(18) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00facesessdate_sestim_uix (sessionid, timestart)
, UNIQUE KEY pu_00facesessdate_sestim2_uix (sessionid, timefinish)
, KEY pu_00facesessdate_ses_ix (sessionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Describes sessions of event. Specifies the start time, end t';
CREATE TABLE pu_00facetoface_signups (
    id BIGINT(10) NOT NULL auto_increment,
    sessionid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    discountcode LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    notificationtype BIGINT(10) NOT NULL,
    archived TINYINT(1) NOT NULL DEFAULT 0,
    bookedby BIGINT(10) DEFAULT 0,
    managerid BIGINT(10),
    jobassignmentid BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facesign_usesesarc_ix (userid, sessionid, archived)
, KEY pu_00facesign_ses_ix (sessionid)
, KEY pu_00facesign_use_ix (userid)
, KEY pu_00facesign_man_ix (managerid)
, KEY pu_00facesign_job_ix (jobassignmentid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='User signups for events';
CREATE TABLE pu_00facetoface_signups_status (
    id BIGINT(10) NOT NULL auto_increment,
    signupid BIGINT(10) NOT NULL,
    statuscode BIGINT(10) NOT NULL,
    superceded TINYINT(1) NOT NULL,
    grade NUMERIC(10,5),
    createdby BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facesignstat_sig_ix (signupid)
, KEY pu_00facesignstat_cre_ix (createdby)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Status of user signups, this table keeps the history for eac';
CREATE TABLE pu_00facetoface_signups_dates_status (
    id BIGINT(10) NOT NULL auto_increment,
    signupid BIGINT(10) NOT NULL,
    sessiondateid BIGINT(10) NOT NULL,
    attendancecode BIGINT(10) NOT NULL,
    superceded TINYINT(1) NOT NULL,
    createdby BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facesigndatestat_sig_ix (signupid)
, KEY pu_00facesigndatestat_ses_ix (sessiondateid)
, KEY pu_00facesigndatestat_cre_ix (createdby)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Status of user signups, this table keeps the date for each u';
CREATE TABLE pu_00facetoface_session_info_data (
    id BIGINT(10) NOT NULL auto_increment,
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fieldid BIGINT(18) NOT NULL,
    facetofacesessionid BIGINT(18) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00facesessinfodata_fief_uix (fieldid, facetofacesessionid)
, KEY pu_00facesessinfodata_fie_ix (fieldid)
, KEY pu_00facesessinfodata_fac_ix (facetofacesessionid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores custom field data related to event, these fields desc';
CREATE TABLE pu_00facetoface_session_info_data_param (
    id BIGINT(10) NOT NULL auto_increment,
    dataid BIGINT(10) NOT NULL,
    value VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facesessinfodatapara_v_ix (value)
, KEY pu_00facesessinfodatapara_d_ix (dataid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Custom event fields data parameters';
CREATE TABLE pu_00facetoface_session_info_field (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    datatype VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    sortorder BIGINT(18) NOT NULL,
    hidden TINYINT(2) NOT NULL,
    locked TINYINT(2) NOT NULL,
    required TINYINT(2) NOT NULL,
    forceunique TINYINT(2) NOT NULL,
    defaultdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param5 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullname VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_general_ci,
    showinsummary TINYINT(1) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Stores the definitions for event custom fields';
CREATE TABLE pu_00facetoface_signup_info_data (
    id BIGINT(10) NOT NULL auto_increment,
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fieldid BIGINT(18) NOT NULL,
    facetofacesignupid BIGINT(18) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00facesigninfodata_fief_uix (fieldid, facetofacesignupid)
, KEY pu_00facesigninfodata_fie_ix (fieldid)
, KEY pu_00facesigninfodata_fac_ix (facetofacesignupid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores custom field data related to user signups for events,';
CREATE TABLE pu_00facetoface_signup_info_data_param (
    id BIGINT(10) NOT NULL auto_increment,
    dataid BIGINT(10) NOT NULL,
    value VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facesigninfodatapara_v_ix (value)
, KEY pu_00facesigninfodatapara_d_ix (dataid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Custom event signup fields data parameters';
CREATE TABLE pu_00facetoface_signup_info_field (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    datatype VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    sortorder BIGINT(18) NOT NULL,
    hidden TINYINT(2) NOT NULL,
    locked TINYINT(2) NOT NULL,
    required TINYINT(2) NOT NULL,
    forceunique TINYINT(2) NOT NULL,
    defaultdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param5 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullname VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Stores the definitions of user signup custom fields';
CREATE TABLE pu_00facetoface_cancellation_info_data (
    id BIGINT(10) NOT NULL auto_increment,
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fieldid BIGINT(18) NOT NULL,
    facetofacecancellationid BIGINT(18) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00facecancinfodata_fief_uix (fieldid, facetofacecancellationid)
, KEY pu_00facecancinfodata_fie_ix (fieldid)
, KEY pu_00facecancinfodata_fac_ix (facetofacecancellationid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores custom field data related to user signup cancellation';
CREATE TABLE pu_00facetoface_cancellation_info_data_param (
    id BIGINT(10) NOT NULL auto_increment,
    dataid BIGINT(10) NOT NULL,
    value VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facecancinfodatapara_v_ix (value)
, KEY pu_00facecancinfodatapara_d_ix (dataid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Custom user signup cancellation fields data parameters';
CREATE TABLE pu_00facetoface_cancellation_info_field (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    datatype VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    sortorder BIGINT(18) NOT NULL,
    hidden TINYINT(2) NOT NULL,
    locked TINYINT(2) NOT NULL,
    required TINYINT(2) NOT NULL,
    forceunique TINYINT(2) NOT NULL,
    defaultdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param5 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullname VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Stores the definitions for user signup cancellation custom f';
CREATE TABLE pu_00facetoface_sessioncancel_info_data (
    id BIGINT(10) NOT NULL auto_increment,
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fieldid BIGINT(10) NOT NULL,
    facetofacesessioncancelid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00facesessinfodata_fie2_uix (fieldid, facetofacesessioncancelid)
, KEY pu_00facesessinfodata_fie2_ix (fieldid)
, KEY pu_00facesessinfodata_fac2_ix (facetofacesessioncancelid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores custom field data related to cancellation of the whol';
CREATE TABLE pu_00facetoface_sessioncancel_info_data_param (
    id BIGINT(10) NOT NULL auto_increment,
    dataid BIGINT(10) NOT NULL,
    value VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facesessinfodatapara_2_ix (value)
, KEY pu_00facesessinfodatapara_3_ix (dataid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Whole event cancellation custom fields data parameters';
CREATE TABLE pu_00facetoface_sessioncancel_info_field (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    datatype VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    sortorder BIGINT(18) NOT NULL,
    hidden TINYINT(2) NOT NULL,
    locked TINYINT(2) NOT NULL,
    required TINYINT(2) NOT NULL,
    forceunique TINYINT(2) NOT NULL,
    defaultdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param5 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullname VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Stores the definitions for whole event cancellation custom f';
CREATE TABLE pu_00facetoface_notification_tpl (
    id BIGINT(10) NOT NULL auto_increment,
    title LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    body LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    ccmanager TINYINT(1) NOT NULL DEFAULT 0,
    managerprefix LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    status TINYINT(1) NOT NULL DEFAULT 0,
    reference VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facenotitpl_sta_ix (status)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Seminar notification templates';
CREATE TABLE pu_00facetoface_notification (
    id BIGINT(10) NOT NULL auto_increment,
    type TINYINT(1) NOT NULL,
    conditiontype BIGINT(10),
    scheduleunit TINYINT(1),
    scheduleamount TINYINT(1),
    scheduletime BIGINT(10),
    ccmanager TINYINT(1) NOT NULL DEFAULT 0,
    managerprefix LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    title LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    body LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    booked TINYINT(1) NOT NULL DEFAULT 0,
    waitlisted TINYINT(1) NOT NULL DEFAULT 0,
    cancelled TINYINT(1) NOT NULL DEFAULT 0,
    requested TINYINT(1) NOT NULL DEFAULT 0,
    courseid BIGINT(10) NOT NULL,
    facetofaceid BIGINT(10) NOT NULL,
    templateid BIGINT(10) NOT NULL DEFAULT 0,
    status TINYINT(1) NOT NULL DEFAULT 0,
    issent TINYINT(1) NOT NULL DEFAULT 0,
    timemodified BIGINT(10),
    usermodified BIGINT(10),
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facenoti_typ_ix (type)
, KEY pu_00facenoti_sta_ix (status)
, KEY pu_00facenoti_iss_ix (issent)
, KEY pu_00facenoti_cou_ix (courseid)
, KEY pu_00facenoti_fac_ix (facetofaceid)
, KEY pu_00facenoti_use_ix (usermodified)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Seminar notifications';
CREATE TABLE pu_00facetoface_notification_sent (
    id BIGINT(10) NOT NULL auto_increment,
    notificationid BIGINT(10) NOT NULL DEFAULT 0,
    sessionid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facenotisent_not_ix (notificationid)
, KEY pu_00facenotisent_ses_ix (sessionid)
, KEY pu_00facenotisent_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Seminar notification reciepts';
CREATE TABLE pu_00facetoface_room (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    capacity BIGINT(10) DEFAULT 0,
    allowconflicts TINYINT(1) NOT NULL DEFAULT 0,
    url VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    custom TINYINT(1) NOT NULL DEFAULT 0,
    hidden TINYINT(1) NOT NULL DEFAULT 0,
    usercreated BIGINT(10),
    usermodified BIGINT(10),
    timecreated BIGINT(10) DEFAULT 0,
    timemodified BIGINT(10) DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00faceroom_cus_ix (custom)
, KEY pu_00faceroom_use_ix (usercreated)
, KEY pu_00faceroom_use2_ix (usermodified)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Table for storing seminar room data';
CREATE TABLE pu_00facetoface_notification_hist (
    id BIGINT(10) NOT NULL auto_increment,
    notificationid BIGINT(10) NOT NULL,
    sessionid BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    sessiondateid BIGINT(10) NOT NULL,
    ical_uid VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    ical_method VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci,
    timecreated BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facenotihist_not_ix (notificationid)
, KEY pu_00facenotihist_ses_ix (sessionid)
, KEY pu_00facenotihist_ses2_ix (sessiondateid)
, KEY pu_00facenotihist_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Notifications history (stores ical event information)';
CREATE TABLE pu_00facetoface_interest (
    id BIGINT(10) NOT NULL auto_increment,
    facetoface BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    timedeclared BIGINT(20) NOT NULL DEFAULT 0,
    reason LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00faceinte_fac_ix (facetoface)
, KEY pu_00faceinte_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Users who have declared interest in a seminar activity';
CREATE TABLE pu_00facetoface_room_info_data (
    id BIGINT(10) NOT NULL auto_increment,
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fieldid BIGINT(10) NOT NULL,
    facetofaceroomid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00faceroominfodata_fief_uix (fieldid, facetofaceroomid)
, KEY pu_00faceroominfodata_fie_ix (fieldid)
, KEY pu_00faceroominfodata_fac_ix (facetofaceroomid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores custom field data related to rooms';
CREATE TABLE pu_00facetoface_room_info_data_param (
    id BIGINT(10) NOT NULL auto_increment,
    dataid BIGINT(10) NOT NULL,
    value VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00faceroominfodatapara_v_ix (value)
, KEY pu_00faceroominfodatapara_d_ix (dataid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Custom room fields data parameters';
CREATE TABLE pu_00facetoface_room_info_field (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    datatype VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    sortorder BIGINT(10) NOT NULL,
    hidden TINYINT(2) NOT NULL,
    locked TINYINT(2) NOT NULL,
    required TINYINT(2) NOT NULL,
    forceunique TINYINT(2) NOT NULL,
    defaultdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param5 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullname VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Stores the definition of available room custom fields';
CREATE TABLE pu_00facetoface_asset (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    allowconflicts TINYINT(1) NOT NULL DEFAULT 0,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    custom TINYINT(1) NOT NULL DEFAULT 0,
    hidden TINYINT(1) NOT NULL DEFAULT 0,
    usercreated BIGINT(10),
    usermodified BIGINT(10),
    timecreated BIGINT(10) DEFAULT 0,
    timemodified BIGINT(10) DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00faceasse_cus_ix (custom)
, KEY pu_00faceasse_use_ix (usercreated)
, KEY pu_00faceasse_use2_ix (usermodified)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Table for storing seminar assets data';
CREATE TABLE pu_00facetoface_asset_info_data (
    id BIGINT(10) NOT NULL auto_increment,
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fieldid BIGINT(10) NOT NULL,
    facetofaceassetid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00faceasseinfodata_fief_uix (fieldid, facetofaceassetid)
, KEY pu_00faceasseinfodata_fie_ix (fieldid)
, KEY pu_00faceasseinfodata_fac_ix (facetofaceassetid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores custom field data related to assets';
CREATE TABLE pu_00facetoface_asset_info_data_param (
    id BIGINT(10) NOT NULL auto_increment,
    dataid BIGINT(10) NOT NULL,
    value VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00faceasseinfodatapara_v_ix (value)
, KEY pu_00faceasseinfodatapara_d_ix (dataid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Asset custom fields data parameters';
CREATE TABLE pu_00facetoface_asset_info_field (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    datatype VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    sortorder BIGINT(10) NOT NULL,
    hidden TINYINT(2) NOT NULL,
    locked TINYINT(2) NOT NULL,
    required TINYINT(2) NOT NULL,
    forceunique TINYINT(2) NOT NULL,
    defaultdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param5 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullname VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Stores the definition of available asset custom fields';
CREATE TABLE pu_00facetoface_asset_dates (
    id BIGINT(10) NOT NULL auto_increment,
    sessionsdateid BIGINT(10) NOT NULL,
    assetid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00faceassedate_sesass_uix (sessionsdateid, assetid)
, KEY pu_00faceassedate_ses_ix (sessionsdateid)
, KEY pu_00faceassedate_ass_ix (assetid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Assets to session dates many-to-many relationship';
CREATE TABLE pu_00facetoface_room_dates (
    id BIGINT(10) NOT NULL auto_increment,
    sessionsdateid BIGINT(10) NOT NULL,
    roomid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00faceroomdate_sesroo_uix (sessionsdateid, roomid)
, KEY pu_00faceroomdate_ses_ix (sessionsdateid)
, KEY pu_00faceroomdate_roo_ix (roomid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Rooms to session dates many-to-many relationship';
CREATE TABLE pu_00facetoface_facilitator (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    allowconflicts TINYINT(1) NOT NULL DEFAULT 0,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    custom TINYINT(1) NOT NULL DEFAULT 0,
    hidden TINYINT(1) NOT NULL DEFAULT 0,
    usercreated BIGINT(10),
    usermodified BIGINT(10),
    timecreated BIGINT(10) DEFAULT 0,
    timemodified BIGINT(10) DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facefaci_cus_ix (custom)
, KEY pu_00facefaci_use_ix (userid)
, KEY pu_00facefaci_use2_ix (usercreated)
, KEY pu_00facefaci_use3_ix (usermodified)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Table for storing seminar facilitator data';
CREATE TABLE pu_00facetoface_facilitator_info_data (
    id BIGINT(10) NOT NULL auto_increment,
    data LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fieldid BIGINT(10) NOT NULL,
    facetofacefacilitatorid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00facefaciinfodata_fief_uix (fieldid, facetofacefacilitatorid)
, KEY pu_00facefaciinfodata_fie_ix (fieldid)
, KEY pu_00facefaciinfodata_fac_ix (facetofacefacilitatorid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Stores custom field data related to facilitators';
CREATE TABLE pu_00facetoface_facilitator_info_data_param (
    id BIGINT(10) NOT NULL auto_increment,
    dataid BIGINT(10) NOT NULL,
    value VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00facefaciinfodatapara_v_ix (value)
, KEY pu_00facefaciinfodatapara_d_ix (dataid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='facilitator custom fields data parameters';
CREATE TABLE pu_00facetoface_facilitator_info_field (
    id BIGINT(10) NOT NULL auto_increment,
    shortname VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    datatype VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
    description LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    sortorder BIGINT(10) NOT NULL,
    hidden TINYINT(2) NOT NULL,
    locked TINYINT(2) NOT NULL,
    required TINYINT(2) NOT NULL,
    forceunique TINYINT(2) NOT NULL,
    defaultdata LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param1 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param2 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param3 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param4 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    param5 LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    fullname VARCHAR(1024) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Compressed
 COMMENT='Stores the definition of available facilitator custom fields';
CREATE TABLE pu_00facetoface_facilitator_dates (
    id BIGINT(10) NOT NULL auto_increment,
    sessionsdateid BIGINT(10) NOT NULL,
    facilitatorid BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, UNIQUE KEY pu_00facefacidate_sesfac_uix (sessionsdateid, facilitatorid)
, KEY pu_00facefacidate_ses_ix (sessionsdateid)
, KEY pu_00facefacidate_fac_ix (facilitatorid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Facilitators to session dates many-to-many relationship';
CREATE TABLE pu_00feedback (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    anonymous TINYINT(1) NOT NULL DEFAULT 1,
    email_notification TINYINT(1) NOT NULL DEFAULT 1,
    multiple_submit TINYINT(1) NOT NULL DEFAULT 1,
    autonumbering TINYINT(1) NOT NULL DEFAULT 1,
    site_after_submit VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    page_after_submit LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    page_after_submitformat TINYINT(2) NOT NULL DEFAULT 0,
    publish_stats TINYINT(1) NOT NULL DEFAULT 0,
    timeopen BIGINT(10) NOT NULL DEFAULT 0,
    timeclose BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    completionsubmit TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00feed_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='all feedbacks';
CREATE TABLE pu_00feedback_template (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    ispublic TINYINT(1) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00feedtemp_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='templates of feedbackstructures';
CREATE TABLE pu_00feedback_item (
    id BIGINT(10) NOT NULL auto_increment,
    feedback BIGINT(10) NOT NULL DEFAULT 0,
    template BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    label VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    presentation LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    typ VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    hasvalue TINYINT(1) NOT NULL DEFAULT 0,
    position SMALLINT(3) NOT NULL DEFAULT 0,
    required TINYINT(1) NOT NULL DEFAULT 0,
    dependitem BIGINT(10) NOT NULL DEFAULT 0,
    dependvalue VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    options VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00feeditem_fee_ix (feedback)
, KEY pu_00feeditem_tem_ix (template)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='feedback_items';
CREATE TABLE pu_00feedback_completed (
    id BIGINT(10) NOT NULL auto_increment,
    feedback BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    random_response BIGINT(10) NOT NULL DEFAULT 0,
    anonymous_response TINYINT(1) NOT NULL DEFAULT 0,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00feedcomp_use_ix (userid)
, KEY pu_00feedcomp_fee_ix (feedback)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='filled out feedback';
CREATE TABLE pu_00feedback_completed_history (
    id BIGINT(10) NOT NULL auto_increment,
    feedback BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    random_response BIGINT(10) NOT NULL DEFAULT 0,
    anonymous_response TINYINT(1) NOT NULL DEFAULT 0,
    timearchived BIGINT(10) NOT NULL,
    idarchived BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00feedcomphist_fee_ix (feedback)
, KEY pu_00feedcomphist_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='history of filled out feedback';
CREATE TABLE pu_00feedback_completedtmp (
    id BIGINT(10) NOT NULL auto_increment,
    feedback BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    guestid VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    random_response BIGINT(10) NOT NULL DEFAULT 0,
    anonymous_response TINYINT(1) NOT NULL DEFAULT 0,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00feedcomp_use2_ix (userid)
, KEY pu_00feedcomp_fee2_ix (feedback)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='filled out feedback';
CREATE TABLE pu_00feedback_value (
    id BIGINT(10) NOT NULL auto_increment,
    course_id BIGINT(10) NOT NULL DEFAULT 0,
    item BIGINT(10) NOT NULL DEFAULT 0,
    completed BIGINT(10) NOT NULL DEFAULT 0,
    tmp_completed BIGINT(10) NOT NULL DEFAULT 0,
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00feedvalu_cou_ix (course_id)
, UNIQUE KEY pu_00feedvalu_comitecou_uix (completed, item, course_id)
, KEY pu_00feedvalu_ite_ix (item)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='values of the completeds';
CREATE TABLE pu_00feedback_value_history (
    id BIGINT(10) NOT NULL auto_increment,
    course_id BIGINT(10) NOT NULL DEFAULT 0,
    item BIGINT(10) NOT NULL DEFAULT 0,
    completed BIGINT(10) NOT NULL DEFAULT 0,
    tmp_completed BIGINT(10) NOT NULL DEFAULT 0,
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    timearchived BIGINT(10) NOT NULL,
    idarchived BIGINT(10) NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00feedvaluhist_ite_ix (item)
, KEY pu_00feedvaluhist_com_ix (completed)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='History of values of the completeds';
CREATE TABLE pu_00feedback_valuetmp (
    id BIGINT(10) NOT NULL auto_increment,
    course_id BIGINT(10) NOT NULL DEFAULT 0,
    item BIGINT(10) NOT NULL DEFAULT 0,
    completed BIGINT(10) NOT NULL DEFAULT 0,
    tmp_completed BIGINT(10) NOT NULL DEFAULT 0,
    value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00feedvalu_cou2_ix (course_id)
, UNIQUE KEY pu_00feedvalu_comitecou2_uix (completed, item, course_id)
, KEY pu_00feedvalu_ite2_ix (item)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='values of the completedstmp';
CREATE TABLE pu_00feedback_sitecourse_map (
    id BIGINT(10) NOT NULL auto_increment,
    feedbackid BIGINT(10) NOT NULL DEFAULT 0,
    courseid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00feedsitemap_cou_ix (courseid)
, KEY pu_00feedsitemap_fee_ix (feedbackid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='feedback sitecourse map';
CREATE TABLE pu_00folder (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    revision BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    display SMALLINT(4) NOT NULL DEFAULT 0,
    showexpanded TINYINT(1) NOT NULL DEFAULT 1,
    showdownloadfolder TINYINT(1) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00fold_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='each record is one folder resource';
CREATE TABLE pu_00forum (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    type VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'general',
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    assessed BIGINT(10) NOT NULL DEFAULT 0,
    assesstimestart BIGINT(10) NOT NULL DEFAULT 0,
    assesstimefinish BIGINT(10) NOT NULL DEFAULT 0,
    scale BIGINT(10) NOT NULL DEFAULT 0,
    maxbytes BIGINT(10) NOT NULL DEFAULT 0,
    maxattachments BIGINT(10) NOT NULL DEFAULT 1,
    forcesubscribe TINYINT(1) NOT NULL DEFAULT 0,
    trackingtype TINYINT(2) NOT NULL DEFAULT 1,
    rsstype TINYINT(2) NOT NULL DEFAULT 0,
    rssarticles TINYINT(2) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    warnafter BIGINT(10) NOT NULL DEFAULT 0,
    blockafter BIGINT(10) NOT NULL DEFAULT 0,
    blockperiod BIGINT(10) NOT NULL DEFAULT 0,
    completiondiscussions INT(9) NOT NULL DEFAULT 0,
    completionreplies INT(9) NOT NULL DEFAULT 0,
    completionposts INT(9) NOT NULL DEFAULT 0,
    displaywordcount TINYINT(1) NOT NULL DEFAULT 0,
    lockdiscussionafter BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00foru_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Forums contain and structure discussion';
CREATE TABLE pu_00forum_discussions (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    forum BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    firstpost BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    groupid BIGINT(10) NOT NULL DEFAULT -1,
    assessed TINYINT(1) NOT NULL DEFAULT 1,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    usermodified BIGINT(10) NOT NULL DEFAULT 0,
    timestart BIGINT(10) NOT NULL DEFAULT 0,
    timeend BIGINT(10) NOT NULL DEFAULT 0,
    pinned TINYINT(1) NOT NULL DEFAULT 0,
    archived TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00forudisc_use_ix (userid)
, KEY pu_00forudisc_cou_ix (course)
, KEY pu_00forudisc_for_ix (forum)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Forums are composed of discussions';
CREATE TABLE pu_00forum_posts (
    id BIGINT(10) NOT NULL auto_increment,
    discussion BIGINT(10) NOT NULL DEFAULT 0,
    parent BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    created BIGINT(10) NOT NULL DEFAULT 0,
    modified BIGINT(10) NOT NULL DEFAULT 0,
    mailed TINYINT(2) NOT NULL DEFAULT 0,
    subject VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    message LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    messageformat TINYINT(2) NOT NULL DEFAULT 0,
    messagetrust TINYINT(2) NOT NULL DEFAULT 0,
    attachment VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    totalscore SMALLINT(4) NOT NULL DEFAULT 0,
    mailnow BIGINT(10) NOT NULL DEFAULT 0,
    archived TINYINT(1) NOT NULL DEFAULT 0,
    deleted TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00forupost_use_ix (userid)
, KEY pu_00forupost_cre_ix (created)
, KEY pu_00forupost_mai_ix (mailed)
, KEY pu_00forupost_dis_ix (discussion)
, KEY pu_00forupost_par_ix (parent)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='All posts are stored in this table';
CREATE TABLE pu_00forum_queue (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    discussionid BIGINT(10) NOT NULL DEFAULT 0,
    postid BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00foruqueu_use_ix (userid)
, KEY pu_00foruqueu_dis_ix (discussionid)
, KEY pu_00foruqueu_pos_ix (postid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='For keeping track of posts that will be mailed in digest for';
CREATE TABLE pu_00forum_subscriptions (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    forum BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00forusubs_use_ix (userid)
, KEY pu_00forusubs_for_ix (forum)
, UNIQUE KEY pu_00forusubs_usefor_uix (userid, forum)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Keeps track of who is subscribed to what forum';
CREATE TABLE pu_00forum_digests (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL,
    forum BIGINT(10) NOT NULL,
    maildigest TINYINT(1) NOT NULL DEFAULT -1,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00forudige_use_ix (userid)
, KEY pu_00forudige_for_ix (forum)
, UNIQUE KEY pu_00forudige_forusemai_uix (forum, userid, maildigest)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Keeps track of user mail delivery preferences for each forum';
CREATE TABLE pu_00forum_read (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    forumid BIGINT(10) NOT NULL DEFAULT 0,
    discussionid BIGINT(10) NOT NULL DEFAULT 0,
    postid BIGINT(10) NOT NULL DEFAULT 0,
    firstread BIGINT(10) NOT NULL DEFAULT 0,
    lastread BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00foruread_usefor_ix (userid, forumid)
, KEY pu_00foruread_usedis_ix (userid, discussionid)
, KEY pu_00foruread_posuse_ix (postid, userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Tracks each users read posts';
CREATE TABLE pu_00forum_track_prefs (
    id BIGINT(10) NOT NULL auto_increment,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    forumid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00forutracpref_usefor_ix (userid, forumid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Tracks each users untracked forums';
CREATE TABLE pu_00forum_discussion_subs (
    id BIGINT(10) NOT NULL auto_increment,
    forum BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    discussion BIGINT(10) NOT NULL,
    preference BIGINT(10) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00forudiscsubs_for_ix (forum)
, KEY pu_00forudiscsubs_use_ix (userid)
, KEY pu_00forudiscsubs_dis_ix (discussion)
, UNIQUE KEY pu_00forudiscsubs_usedis_uix (userid, discussion)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Users may choose to subscribe and unsubscribe from specific ';
CREATE TABLE pu_00glossary (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    allowduplicatedentries TINYINT(2) NOT NULL DEFAULT 0,
    displayformat VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'dictionary',
    mainglossary TINYINT(2) NOT NULL DEFAULT 0,
    showspecial TINYINT(2) NOT NULL DEFAULT 1,
    showalphabet TINYINT(2) NOT NULL DEFAULT 1,
    showall TINYINT(2) NOT NULL DEFAULT 1,
    allowcomments TINYINT(2) NOT NULL DEFAULT 0,
    allowprintview TINYINT(2) NOT NULL DEFAULT 1,
    usedynalink TINYINT(2) NOT NULL DEFAULT 1,
    defaultapproval TINYINT(2) NOT NULL DEFAULT 1,
    approvaldisplayformat VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'default',
    globalglossary TINYINT(2) NOT NULL DEFAULT 0,
    entbypage SMALLINT(3) NOT NULL DEFAULT 10,
    editalways TINYINT(2) NOT NULL DEFAULT 0,
    rsstype TINYINT(2) NOT NULL DEFAULT 0,
    rssarticles TINYINT(2) NOT NULL DEFAULT 0,
    assessed BIGINT(10) NOT NULL DEFAULT 0,
    assesstimestart BIGINT(10) NOT NULL DEFAULT 0,
    assesstimefinish BIGINT(10) NOT NULL DEFAULT 0,
    scale BIGINT(10) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    completionentries INT(9) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00glos_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='all glossaries';
CREATE TABLE pu_00glossary_entries (
    id BIGINT(10) NOT NULL auto_increment,
    glossaryid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    concept VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    definition LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    definitionformat TINYINT(2) NOT NULL DEFAULT 0,
    definitiontrust TINYINT(2) NOT NULL DEFAULT 0,
    attachment VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    teacherentry TINYINT(2) NOT NULL DEFAULT 0,
    sourceglossaryid BIGINT(10) NOT NULL DEFAULT 0,
    usedynalink TINYINT(2) NOT NULL DEFAULT 1,
    casesensitive TINYINT(2) NOT NULL DEFAULT 0,
    fullmatch TINYINT(2) NOT NULL DEFAULT 1,
    approved TINYINT(2) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00glosentr_use_ix (userid)
, KEY pu_00glosentr_con_ix (concept)
, KEY pu_00glosentr_glo_ix (glossaryid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='all glossary entries';
CREATE TABLE pu_00glossary_alias (
    id BIGINT(10) NOT NULL auto_increment,
    entryid BIGINT(10) NOT NULL DEFAULT 0,
    alias VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00glosalia_ent_ix (entryid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='entries alias';
CREATE TABLE pu_00glossary_categories (
    id BIGINT(10) NOT NULL auto_increment,
    glossaryid BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    usedynalink TINYINT(2) NOT NULL DEFAULT 1,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00gloscate_glo_ix (glossaryid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='all categories for glossary entries';
CREATE TABLE pu_00glossary_entries_categories (
    id BIGINT(10) NOT NULL auto_increment,
    categoryid BIGINT(10) NOT NULL DEFAULT 0,
    entryid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00glosentrcate_cat_ix (categoryid)
, KEY pu_00glosentrcate_ent_ix (entryid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='categories of each glossary entry';
CREATE TABLE pu_00glossary_formats (
    id BIGINT(10) NOT NULL auto_increment,
    name VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    popupformatname VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    visible TINYINT(2) NOT NULL DEFAULT 1,
    showgroup TINYINT(2) NOT NULL DEFAULT 1,
    showtabs VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci,
    defaultmode VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    defaulthook VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    sortkey VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    sortorder VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONSTRAINT  PRIMARY KEY (id)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Setting of the display formats';
CREATE TABLE pu_00imscp (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    revision BIGINT(10) NOT NULL DEFAULT 0,
    keepold BIGINT(10) NOT NULL DEFAULT -1,
    structure LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00imsc_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='each record is one imscp resource';
CREATE TABLE pu_00label (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    introformat SMALLINT(4) DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00labe_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines labels';
CREATE TABLE pu_00lesson (
    id BIGINT(10) NOT NULL auto_increment,
    course BIGINT(10) NOT NULL DEFAULT 0,
    name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    intro LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    introformat SMALLINT(4) NOT NULL DEFAULT 0,
    practice SMALLINT(3) NOT NULL DEFAULT 0,
    modattempts SMALLINT(3) NOT NULL DEFAULT 0,
    usepassword SMALLINT(3) NOT NULL DEFAULT 0,
    password VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    dependency BIGINT(10) NOT NULL DEFAULT 0,
    conditions LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    grade BIGINT(10) NOT NULL DEFAULT 0,
    custom SMALLINT(3) NOT NULL DEFAULT 0,
    ongoing SMALLINT(3) NOT NULL DEFAULT 0,
    usemaxgrade SMALLINT(3) NOT NULL DEFAULT 0,
    maxanswers SMALLINT(3) NOT NULL DEFAULT 4,
    maxattempts SMALLINT(3) NOT NULL DEFAULT 5,
    review SMALLINT(3) NOT NULL DEFAULT 0,
    nextpagedefault SMALLINT(3) NOT NULL DEFAULT 0,
    feedback SMALLINT(3) NOT NULL DEFAULT 1,
    minquestions SMALLINT(3) NOT NULL DEFAULT 0,
    maxpages SMALLINT(3) NOT NULL DEFAULT 0,
    timelimit BIGINT(10) NOT NULL DEFAULT 0,
    retake SMALLINT(3) NOT NULL DEFAULT 1,
    activitylink BIGINT(10) NOT NULL DEFAULT 0,
    mediafile VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    mediaheight BIGINT(10) NOT NULL DEFAULT 100,
    mediawidth BIGINT(10) NOT NULL DEFAULT 650,
    mediaclose SMALLINT(3) NOT NULL DEFAULT 0,
    slideshow SMALLINT(3) NOT NULL DEFAULT 0,
    width BIGINT(10) NOT NULL DEFAULT 640,
    height BIGINT(10) NOT NULL DEFAULT 480,
    bgcolor VARCHAR(7) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '#FFFFFF',
    displayleft SMALLINT(3) NOT NULL DEFAULT 0,
    displayleftif SMALLINT(3) NOT NULL DEFAULT 0,
    progressbar SMALLINT(3) NOT NULL DEFAULT 0,
    available BIGINT(10) NOT NULL DEFAULT 0,
    deadline BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    completionendreached TINYINT(1) DEFAULT 0,
    completiontimespent BIGINT(11) DEFAULT 0,
    allowofflineattempts TINYINT(1) DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00less_cou_ix (course)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines lesson';
CREATE TABLE pu_00lesson_pages (
    id BIGINT(10) NOT NULL auto_increment,
    lessonid BIGINT(10) NOT NULL DEFAULT 0,
    prevpageid BIGINT(10) NOT NULL DEFAULT 0,
    nextpageid BIGINT(10) NOT NULL DEFAULT 0,
    qtype SMALLINT(3) NOT NULL DEFAULT 0,
    qoption SMALLINT(3) NOT NULL DEFAULT 0,
    layout SMALLINT(3) NOT NULL DEFAULT 1,
    display SMALLINT(3) NOT NULL DEFAULT 1,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    title VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
    contents LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    contentsformat TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00lesspage_les_ix (lessonid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines lesson_pages';
CREATE TABLE pu_00lesson_answers (
    id BIGINT(10) NOT NULL auto_increment,
    lessonid BIGINT(10) NOT NULL DEFAULT 0,
    pageid BIGINT(10) NOT NULL DEFAULT 0,
    jumpto BIGINT(11) NOT NULL DEFAULT 0,
    grade SMALLINT(4) NOT NULL DEFAULT 0,
    score BIGINT(10) NOT NULL DEFAULT 0,
    flags SMALLINT(3) NOT NULL DEFAULT 0,
    timecreated BIGINT(10) NOT NULL DEFAULT 0,
    timemodified BIGINT(10) NOT NULL DEFAULT 0,
    answer LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    answerformat TINYINT(2) NOT NULL DEFAULT 0,
    response LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    responseformat TINYINT(2) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00lessansw_les_ix (lessonid)
, KEY pu_00lessansw_pag_ix (pageid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines lesson_answers';
CREATE TABLE pu_00lesson_attempts (
    id BIGINT(10) NOT NULL auto_increment,
    lessonid BIGINT(10) NOT NULL DEFAULT 0,
    pageid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    answerid BIGINT(10) NOT NULL DEFAULT 0,
    retry SMALLINT(3) NOT NULL DEFAULT 0,
    correct BIGINT(10) NOT NULL DEFAULT 0,
    useranswer LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
    timeseen BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00lessatte_use_ix (userid)
, KEY pu_00lessatte_les_ix (lessonid)
, KEY pu_00lessatte_pag_ix (pageid)
, KEY pu_00lessatte_ans_ix (answerid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines lesson_attempts';
CREATE TABLE pu_00lesson_grades (
    id BIGINT(10) NOT NULL auto_increment,
    lessonid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    grade DOUBLE NOT NULL DEFAULT 0,
    late SMALLINT(3) NOT NULL DEFAULT 0,
    completed BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00lessgrad_use_ix (userid)
, KEY pu_00lessgrad_les_ix (lessonid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='Defines lesson_grades';
CREATE TABLE pu_00lesson_timer (
    id BIGINT(10) NOT NULL auto_increment,
    lessonid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    starttime BIGINT(10) NOT NULL DEFAULT 0,
    lessontime BIGINT(10) NOT NULL DEFAULT 0,
    completed TINYINT(1) DEFAULT 0,
    timemodifiedoffline BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00lesstime_use_ix (userid)
, KEY pu_00lesstime_les_ix (lessonid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='lesson timer for each lesson';
CREATE TABLE pu_00lesson_branch (
    id BIGINT(10) NOT NULL auto_increment,
    lessonid BIGINT(10) NOT NULL DEFAULT 0,
    userid BIGINT(10) NOT NULL DEFAULT 0,
    pageid BIGINT(10) NOT NULL DEFAULT 0,
    retry BIGINT(10) NOT NULL DEFAULT 0,
    flag SMALLINT(3) NOT NULL DEFAULT 0,
    timeseen BIGINT(10) NOT NULL DEFAULT 0,
    nextpageid BIGINT(10) NOT NULL DEFAULT 0,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00lessbran_use_ix (userid)
, KEY pu_00lessbran_les_ix (lessonid)
, KEY pu_00lessbran_pag_ix (pageid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='branches for each lesson/user';
CREATE TABLE pu_00lesson_overrides (
    id BIGINT(10) NOT NULL auto_increment,
    lessonid BIGINT(10) NOT NULL DEFAULT 0,
    groupid BIGINT(10),
    userid BIGINT(10),
    available BIGINT(10),
    deadline BIGINT(10),
    timelimit BIGINT(10),
    review SMALLINT(3),
    maxattempts SMALLINT(3),
    retake SMALLINT(3),
    password VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY pu_00lessover_les_ix (lessonid)
, KEY pu_00lessover_gro_ix (groupid)
, KEY pu_00lessover_use_ix (userid)
)
 ENGINE = InnoDB
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE = utf8_general_ci 
 ROW_FORMAT=Dynamic
 COMMENT='The overrides to lesson settings.';
