mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-62325 enrol_paypal: Added some keys and indexes to enrol_paypal.
- Added these keys to the enrol_paypal db: courseid, userid, instanceid - Added these indexes to the enrol_paypal db: business, receiver_email
This commit is contained in:
parent
6153be6850
commit
d6e821294e
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="enrol/paypal/db" VERSION="20120122" COMMENT="XMLDB file for Moodle enrol/paypal"
|
||||
<XMLDB PATH="enrol/paypal/db" VERSION="20180625" COMMENT="XMLDB file for Moodle enrol/paypal"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@ -30,7 +30,14 @@
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
<KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
|
||||
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
|
||||
<KEY NAME="instanceid" TYPE="foreign" FIELDS="instanceid" REFTABLE="enrol" REFFIELDS="id"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="business" UNIQUE="false" FIELDS="business"/>
|
||||
<INDEX NAME="receiver_email" UNIQUE="false" FIELDS="receiver_email"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
@ -75,5 +75,68 @@ function xmldb_enrol_paypal_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2018053000, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018062500) {
|
||||
|
||||
// Define key courseid (foreign) to be added to enrol_paypal.
|
||||
$table = new xmldb_table('enrol_paypal');
|
||||
$key = new xmldb_key('courseid', XMLDB_KEY_FOREIGN, array('courseid'), 'course', array('id'));
|
||||
|
||||
// Launch add key courseid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Paypal savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018062500, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018062501) {
|
||||
|
||||
// Define key userid (foreign) to be added to enrol_paypal.
|
||||
$table = new xmldb_table('enrol_paypal');
|
||||
$key = new xmldb_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
|
||||
|
||||
// Launch add key userid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Paypal savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018062501, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018062502) {
|
||||
|
||||
// Define key instanceid (foreign) to be added to enrol_paypal.
|
||||
$table = new xmldb_table('enrol_paypal');
|
||||
$key = new xmldb_key('instanceid', XMLDB_KEY_FOREIGN, array('instanceid'), 'enrol', array('id'));
|
||||
|
||||
// Launch add key instanceid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Paypal savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018062502, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018062503) {
|
||||
|
||||
$table = new xmldb_table('enrol_paypal');
|
||||
|
||||
// Define index business (not unique) to be added to enrol_paypal.
|
||||
$index = new xmldb_index('business', XMLDB_INDEX_NOTUNIQUE, array('business'));
|
||||
|
||||
// Conditionally launch add index business.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index receiver_email (not unique) to be added to enrol_paypal.
|
||||
$index = new xmldb_index('receiver_email', XMLDB_INDEX_NOTUNIQUE, array('receiver_email'));
|
||||
|
||||
// Conditionally launch add index receiver_email.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Paypal savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018062503, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2018053000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2018062503; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2018050800; // Requires this Moodle version
|
||||
$plugin->component = 'enrol_paypal'; // Full name of the plugin (used for diagnostics)
|
||||
|
Loading…
x
Reference in New Issue
Block a user