Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add index to hvp_content_user_data #449

Open
wants to merge 1 commit into
base: stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="userdata" UNIQUE="false" FIELDS="user_id, hvp_id, sub_content_id, data_id"/>
</INDEXES>
</TABLE>
<TABLE NAME="hvp_libraries" COMMENT="Stores information about libraries.">
<FIELDS>
Expand Down
16 changes: 16 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,21 @@ function hvp_upgrade_2020112600() {
}
}

function hvp_upgrade_2022012001() {
global $DB;
$dbman = $DB->get_manager();

$table = new xmldb_table('hvp_content_user_data');

// Define index business (not unique) to be added to enrol_paypal.
$index = new xmldb_index('userdata', XMLDB_INDEX_NOTUNIQUE, ['user_id', 'hvp_id', 'sub_content_id', 'data_id']);

// Conditionally launch add index business.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
}

/**
* Hvp module upgrade function.
*
Expand All @@ -591,6 +606,7 @@ function xmldb_hvp_upgrade($oldversion) {
2020082800,
2020091500,
2020112600,
2022012001,
];

foreach ($upgrades as $version) {
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2022012000;
$plugin->version = 2022012001;
$plugin->requires = 2013051403;
$plugin->cron = 0;
$plugin->component = 'mod_hvp';
Expand Down