Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

<?php
defined('MOODLE_INTERNAL') || die();

function  xmldb_local_cesa_reportes_upgrade($oldversion) {
    global $DB, $CFG;
    
    $dbman = $DB->get_manager();
    
    if ($oldversion < 2023040007) {
        
        $xmldb_table = new xmldb_table('local_cesa_reportes');
        
        
        if(!$dbman->table_exists($xmldb_table)) {

            $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);
            $xmldb_table->add_field($name = 'request_userid', $type = XMLDB_TYPE_INTEGER, $precision=10, $unsigned=null, $notnull=XMLDB_NOTNULL, $sequence=null, $default=null, $previous=null);
            $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);
            $xmldb_table->add_field($name = 'generate_time', $type = XMLDB_TYPE_INTEGER, $precision=10, $unsigned=XMLDB_UNSIGNED, $notnull=null, $sequence=null, $default=null, $previous=null);
            $xmldb_table->add_field($name = 'status', $type = XMLDB_TYPE_INTEGER, $precision=1, $unsigned=XMLDB_UNSIGNED, $notnull=XMLDB_NOTNULL, $sequence=null, $default=0, $previous=null);
            $xmldb_table->add_field($name = 'parameters', $type = XMLDB_TYPE_TEXT, $precision=null, $unsigned=null, $notnull=XMLDB_NOTNULL, $sequence=null, $default=null, $previous=null);
            $xmldb_table->add_field($name = 'filename', $type = XMLDB_TYPE_CHAR, $precision=100, $unsigned=null, $notnull=XMLDB_NOTNULL, $sequence=null, $default=null, $previous=null);
            

            $xmldb_table->add_key($name = 'primary', $type = XMLDB_KEY_PRIMARY, $fields = ['id'], $reftable=null, $reffields=null);
            $xmldb_table->add_key($name = 'request_userid', $type = XMLDB_KEY_FOREIGN, $fields = ['request_userid'], $reftable='user', $reffields=['id']);
            
            $xmldb_table->add_index($name = 'request_time', $type = XMLDB_INDEX_NOTUNIQUE, $fields = ['request_time']);

            $dbman->create_table($xmldb_table);
            
        }
        
        
        
        upgrade_plugin_savepoint(true, 2023040007, 'local', 'cesa_reportes');
    }
    
    return true;
}