Reputation: 5496
I am new to moodle
, I want to create some new table when in moodle, and that too when the initial install is being processed. I made the changes in moodle\lib\db\install.xml
, but it is not taking update for the new table.
My update in install.xml
is:
<TABLE NAME="user_site" COMMENT="Sites">
<FIELDS>
<FIELD LENGTH="3" SEQUENCE="true" TYPE="int" NOTNULL="true" NAME="id"/>
<FIELD LENGTH="4" SEQUENCE="false" TYPE="int" NOTNULL="true" NAME="site_id"/>
</FIELDS>
</TABLE>
As the moodle
was not taking the update on its own, so I deleted the config file, in order to re-initiate the install. But it did not accept the changes either.
Any help.?
Upvotes: 0
Views: 1407
Reputation: 10241
You need to create a local plugin with an install.xml rather than modifying the core code.
http://docs.moodle.org/dev/Local_plugins
First create a folder with web server write access
local/user_site/db/
Then use the xmldb editor to edit the install.xml file
http://docs.moodle.org/dev/XMLDB_editor#Quick_Start
Then create a version file to install the plugin and create the table
local/user_site/version.php
Upvotes: 2