Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
defined('MOODLE_INTERNAL') || die();
3
 
4
function  xmldb_local_cesa_reportes_upgrade($oldversion) {
5
    global $DB, $CFG;
6
 
7
    $dbman = $DB->get_manager();
8
 
9
    if ($oldversion < 2023040007) {
10
 
11
        $xmldb_table = new xmldb_table('local_cesa_reportes');
12
 
13
 
14
        if(!$dbman->table_exists($xmldb_table)) {
15
 
16
            $xmldb_table->add_field($name = 'id', $type = XMLDB_TYPE_INTEGER, $precision=10, $unsigned=XMLDB_UNSIGNED, $notnull=XMLDB_NOTNULL, $sequence=XMLDB_SEQUENCE, $default=null, $previous=null);
17
            $xmldb_table->add_field($name = 'request_userid', $type = XMLDB_TYPE_INTEGER, $precision=10, $unsigned=null, $notnull=XMLDB_NOTNULL, $sequence=null, $default=null, $previous=null);
18
            $xmldb_table->add_field($name = 'request_time', $type = XMLDB_TYPE_INTEGER, $precision=10, $unsigned=XMLDB_UNSIGNED, $notnull=XMLDB_NOTNULL, $sequence=null, $default=null, $previous=null);
19
            $xmldb_table->add_field($name = 'generate_time', $type = XMLDB_TYPE_INTEGER, $precision=10, $unsigned=XMLDB_UNSIGNED, $notnull=null, $sequence=null, $default=null, $previous=null);
20
            $xmldb_table->add_field($name = 'status', $type = XMLDB_TYPE_INTEGER, $precision=1, $unsigned=XMLDB_UNSIGNED, $notnull=XMLDB_NOTNULL, $sequence=null, $default=0, $previous=null);
21
            $xmldb_table->add_field($name = 'parameters', $type = XMLDB_TYPE_TEXT, $precision=null, $unsigned=null, $notnull=XMLDB_NOTNULL, $sequence=null, $default=null, $previous=null);
22
            $xmldb_table->add_field($name = 'filename', $type = XMLDB_TYPE_CHAR, $precision=100, $unsigned=null, $notnull=XMLDB_NOTNULL, $sequence=null, $default=null, $previous=null);
23
 
24
 
25
            $xmldb_table->add_key($name = 'primary', $type = XMLDB_KEY_PRIMARY, $fields = ['id'], $reftable=null, $reffields=null);
26
            $xmldb_table->add_key($name = 'request_userid', $type = XMLDB_KEY_FOREIGN, $fields = ['request_userid'], $reftable='user', $reffields=['id']);
27
 
28
            $xmldb_table->add_index($name = 'request_time', $type = XMLDB_INDEX_NOTUNIQUE, $fields = ['request_time']);
29
 
30
            $dbman->create_table($xmldb_table);
31
 
32
        }
33
 
34
 
35
 
36
        upgrade_plugin_savepoint(true, 2023040007, 'local', 'cesa_reportes');
37
    }
38
 
39
    return true;
40
}