I have a very simple plugin with the following structure:
- lib.php
- version.php
- license.md
- readme.md
- db
- install.xml
I generated the basic structure using the "Moodle plugin skeleton generator" and then generated the install.xml file using the XMLDB Editor in core Moodle. From there, I uninstalled and removed all my files out of the enrol director to a different place
(to make sure it was a "clean" install). Then moved the files back. Moodle picked up that they need to be installed and clicked "Upgrade Moodle Databse", but none of my tables are created. The docs are a little lacking in several places for Moodle,
and I'm very new to this. My understanding was this install.xml file would automatically pick up and create the tables. What am I missing in order to get my tables to install?
install.xml
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="enrol/open_course_code/db" VERSION="20200404" COMMENT="Open Course Code plugin tables" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd" >
<TABLES>
<TABLE NAME="occ_cohorts" COMMENT="Open Course Code plugin management of cohort code numbers">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="cohort_id" TYPE="int" LENGTH="19" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="allowed_codes" TYPE="int" LENGTH="20" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="occ_cohort_ids" TYPE="foreign-unique" FIELDS="cohort_id" REFTABLE="mdl_cohort" REFFIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="occ_codes" COMMENT="Open Course Code plugin codes">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="code" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="used" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="revoked" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="occ_cohort_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="user_id" TYPE="int" LENGTH="19" NOTNULL="false" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="occ_code_cohort" TYPE="foreign" FIELDS="occ_cohort_id" REFTABLE="occ_cohorts" REFFIELDS="id"/>
<KEY NAME="occ_user_code" TYPE="foreign" FIELDS="user_id" REFTABLE="mdl_user" REFFIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
</XMLDB>