-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b31028
commit 4459572
Showing
4 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<XMLDB PATH="enrol/oneroster/db" VERSION="20201207" COMMENT="XMLDB file for Moodle enrol/oneroster" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd" | ||
> | ||
<TABLES> | ||
<TABLE NAME="enrol_oneroster_user_map" COMMENT="Table to map OneRoster sourcedIds to a canonical id"> | ||
<FIELDS> | ||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/> | ||
<FIELD NAME="parentid" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/> | ||
<FIELD NAME="mappedid" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/> | ||
</FIELDS> | ||
<KEYS> | ||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/> | ||
</KEYS> | ||
<INDEXES> | ||
<INDEX NAME="mappedid" UNIQUE="false" FIELDS="mappedid"/> | ||
</INDEXES> | ||
</TABLE> | ||
</TABLES> | ||
</XMLDB> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?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/>. | ||
|
||
/** | ||
* OneRoster enrolment plugin upgrade. | ||
* | ||
* @package enrol_oneroster | ||
* @copyright 2020 Andrew Nicols <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
function xmldb_enrol_oneroster_upgrade($oldversion) { | ||
global $DB; | ||
|
||
$dbman = $DB->get_manager(); | ||
|
||
if ($oldversion < 2020120700) { | ||
|
||
// Define table enrol_oneroster_user_map to be created. | ||
$table = new xmldb_table('enrol_oneroster_user_map'); | ||
|
||
// Adding fields to table enrol_oneroster_user_map. | ||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); | ||
$table->add_field('parentid', XMLDB_TYPE_CHAR, '255', null, null, null, null); | ||
$table->add_field('mappedid', XMLDB_TYPE_CHAR, '255', null, null, null, null); | ||
|
||
// Adding keys to table enrol_oneroster_user_map. | ||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); | ||
|
||
// Adding indexes to table enrol_oneroster_user_map. | ||
$table->add_index('mappedid', XMLDB_INDEX_NOTUNIQUE, ['mappedid']); | ||
|
||
// Conditionally launch create table for enrol_oneroster_user_map. | ||
if (!$dbman->table_exists($table)) { | ||
$dbman->create_table($table); | ||
} | ||
|
||
// Oneroster savepoint reached. | ||
upgrade_plugin_savepoint(true, 2020120700, 'enrol', 'oneroster'); | ||
} | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters