Johannes Burk
9 years ago
5 changed files with 92 additions and 2 deletions
@ -0,0 +1,19 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<XMLDB PATH="enrol/apply/db" VERSION="20160409" COMMENT="XMLDB file for Moodle enrol/apply" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd" |
|||
> |
|||
<TABLES> |
|||
<TABLE NAME="enrol_apply_applicationinfo" COMMENT="Table containing additional information for each enrolment application."> |
|||
<FIELDS> |
|||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/> |
|||
<FIELD NAME="userenrolmentid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="user enrolment id this entry belongs to"/> |
|||
<FIELD NAME="comment" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="comment given by the user during application"/> |
|||
</FIELDS> |
|||
<KEYS> |
|||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/> |
|||
<KEY NAME="userenrolment" TYPE="foreign-unique" FIELDS="userenrolmentid" REFTABLE="user_enrolments" REFFIELDS="id"/> |
|||
</KEYS> |
|||
</TABLE> |
|||
</TABLES> |
|||
</XMLDB> |
@ -0,0 +1,54 @@ |
|||
<?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 enrol_apply |
|||
* @copyright emeneo.com |
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|||
* @author Johannes Burk <johannes.burk@sudile.com> |
|||
*/ |
|||
|
|||
defined('MOODLE_INTERNAL') || die; |
|||
|
|||
function xmldb_enrol_apply_upgrade($oldversion) { |
|||
global $CFG, $DB; |
|||
|
|||
$dbman = $DB->get_manager(); |
|||
|
|||
if ($oldversion < 2016012801) { |
|||
|
|||
// Define table enrol_apply_applicationinfo to be created. |
|||
$table = new xmldb_table('enrol_apply_applicationinfo'); |
|||
|
|||
// Adding fields to table enrol_apply_applicationinfo. |
|||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); |
|||
$table->add_field('userenrolmentid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); |
|||
$table->add_field('comment', XMLDB_TYPE_TEXT, null, null, null, null, null); |
|||
|
|||
// Adding keys to table enrol_apply_applicationinfo. |
|||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); |
|||
$table->add_key('userenrolment', XMLDB_KEY_FOREIGN_UNIQUE, array('userenrolmentid'), 'user_enrolments', array('id')); |
|||
|
|||
// Conditionally launch create table for enrol_apply_applicationinfo. |
|||
if (!$dbman->table_exists($table)) { |
|||
$dbman->create_table($table); |
|||
} |
|||
|
|||
// Apply savepoint reached. |
|||
upgrade_plugin_savepoint(true, 2016012801, 'enrol', 'apply'); |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue