troodle-expcontent/db/upgrade.php
Kumi 3247092e59
feat: add intro fields to exp360 module
Added 'intro' and 'introformat' fields to the exp360 module for enhanced activity descriptions. Updated database schema and upgrade script to accommodate new fields. Modified add and update instance functions and the form to manage intro fields. Bumped module version to 2024070503.
2024-07-05 11:38:10 +02:00

33 lines
No EOL
995 B
PHP

<?php
defined('MOODLE_INTERNAL') || die();
function xmldb_exp360_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2024070503) {
// Define field intro to be added to exp360.
$table = new xmldb_table('exp360');
$field = new xmldb_field('intro', XMLDB_TYPE_TEXT, null, null, null, null, null, 'name');
// Conditionally launch add field intro.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Define field introformat to be added to exp360.
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'intro');
// Conditionally launch add field introformat.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Exp360 savepoint reached.
upgrade_mod_savepoint(true, 2024070503, 'exp360');
}
return true;
}