General developer forum

Creating a table through block/db/upgrade. Moodle 3.4+

 
Davo
Re: Creating a table through block/db/upgrade. Moodle 3.4+
Core developersParticularly helpful MoodlersPlugin developers

The immediate problem that jumps out to me is that you are creating a table, without defining any fields.

If you use Moodle's built-in XMLDB editor, then it should generate the correct content for both the install.xml file and the upgrade.php statements you need.


 
Average of ratings: Useful (1)
Picture of Dave Emsley
Re: Creating a table through block/db/upgrade. Moodle 3.4+
Particularly helpful Moodlers

It does Davo, thanks.

 
Average of ratings: -
Picture of Marcus Green
Re: Creating a table through block/db/upgrade. Moodle 3.4+
Core developersParticularly helpful MoodlersPlugin developersTesters

To add to Davo's comment, the XMLDB editor not only allows you to create a table, but it spits out the PHP that you can copy and paste into an upgrade.php file. I missed that feature when I first started working on it. 


 
Average of ratings: Useful (1)