-
Bug
-
Resolution: Fixed
-
Minor
-
3.7.4, 3.8, 3.9
-
MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
-
MOODLE_37_STABLE, MOODLE_38_STABLE
-
MDL-67886_master -
When installing a fresh moodle, the database is created from the install.xml file. In this file indexes are created implicitly from the key names, for example https://github.com/moodle/moodle/blob/MOODLE_37_STABLE/lib/db/install.xml#L643 this `mdl_message_conversation_members` table is created with 2 indexes, mdl_messconvmemb_con_ix and mdl_messconvmemb_use_ix that are based on the key names.
If one of these indexes is dropped, the index check at admin/tool/xmldb/index.php will tell us to re-add it, but the output from check_database_schema.php will not change or notify us.
I think this is because the check_database_schema script is not checking for indexes created from key names. The check indexes xmldb code does make this check for all indexes: https://github.com/moodle/moodle/blob/master/admin/tool/xmldb/actions/check_indexes/check_indexes.class.php#L56
Shouldn't a schema checking script check these indexes as well?
In a fresh moodle 3.7, I can run `drop index mdl_messconvmemb_use_ix;` and get the screenshot below. But the ouput from check_database_schema is
root@f5bb632af830:/siteroot# php admin/cli/check_database_schema.php |
Database structure is ok.
|