mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-49795 mod_book: Add foreign key for course
This commit is contained in:
parent
af71e4f412
commit
c2167257c9
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="mod/book/db" VERSION="20200907" COMMENT="XMLDB file for Moodle mod_book"
|
||||
<XMLDB PATH="mod/book/db" VERSION="20220530" COMMENT="XMLDB file for Moodle mod_book"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@ -20,6 +20,7 @@
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
<KEY NAME="course" TYPE="foreign" FIELDS="course" REFTABLE="course" REFFIELDS="id"/>
|
||||
</KEYS>
|
||||
</TABLE>
|
||||
<TABLE NAME="book_chapters" COMMENT="Defines book_chapters">
|
||||
|
@ -48,6 +48,16 @@ function xmldb_book_upgrade($oldversion) {
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2022053000) {
|
||||
// Define key course (foreign) to be added to book.
|
||||
$table = new xmldb_table('book');
|
||||
$key = new xmldb_key('course', XMLDB_KEY_FOREIGN, ['course'], 'course', ['id']);
|
||||
// Launch add key course.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Book savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022053000, 'book');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -25,6 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->component = 'mod_book'; // Full name of the plugin (used for diagnostics)
|
||||
$plugin->version = 2022041900; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2022053000; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2022041200; // Requires this Moodle version.
|
||||
$plugin->cron = 0; // Period for cron to check this module (secs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user