upgrade.php 2.11 KB
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * @package qharvest
 * @author Tekstac Development Team <teknoturf.com>
 */

//upgrade.php file for hte harvest question


defined( 'MOODLE_INTERNAL' ) || die();
function xmldb_block_mynotes_upgrade($oldversion) {
	
	global $CFG, $DB;
	
	$dbman = $DB->get_manager();
	
	//Upgrade to add an extra column to local_qharvest_qns_count table
	if( $oldversion < 2018011201 ){
	    
	   $table = new xmldb_table('block_mynotes');
	   
	   if ( $dbman->table_exists($table) ) {
	   	$dbman->drop_table($table);
	   }
	   
		$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
		$table->add_field('contextid',XMLDB_TYPE_INTEGER,'10', null, null, null,null);
		$table->add_field('contextarea', XMLDB_TYPE_CHAR,'255', null, null, null,null);
		$table->add_field('content', XMLDB_TYPE_TEXT, null, null, null,null);
		$table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
		$table->add_field('format', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
		$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
		$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
		$table->add_field('notestime', XMLDB_TYPE_CHAR, '255', null, null, null, null);
		$table->add_field('notesurl', XMLDB_TYPE_CHAR, '255', null, null, null, null);
		
		$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
		$dbman->create_table($table);
	}
	
	
	return true;
}