itamart / moodle-mod_dataform

The Dataform is an enhanced counterpart of the standard Database activity module
17 stars 19 forks source link

Database error after upgrading to v3.3.2 #16

Open julianrubisch opened 6 years ago

julianrubisch commented 6 years ago

I recently upgraded to Moodle 3.3.4 (Build: 20180208), and upgraded mod_dataform to 3.3.2, afterwards got this error:

Debug info: Unknown column 'e.type' in 'field list'
SELECT e.id, e.dataid, e.state, e.timecreated, e.timemodified, e.userid, e.groupid, e.type , u.id AS uid ,u.picture,u.firstname,u.lastname,u.firstnamephonetic,u.lastnamephonetic,u.middlename,u.alternatename,u.imagealt,u.email,u.idnumber,u.username FROM mdl_dataform_entries e JOIN mdl_user u ON u.id = e.userid WHERE e.dataid = ? ORDER BY e.id ASC 
[array (
0 => '11',
)]
Error code: dmlreadexception
Stack trace:
line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 1216 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 234 of /mod/dataform/classes/entry_manager.php: call to mysqli_native_moodle_database->get_records_sql()
line 142 of /mod/dataform/classes/entry_manager.php: call to mod_dataform_entry_manager->fetch_entries()
line 332 of /mod/dataform/classes/pluginbase/dataformview.php: call to mod_dataform_entry_manager->set_content()
line 315 of /mod/dataform/classes/pluginbase/dataformview.php: call to mod_dataform\pluginbase\dataformview->set_entries_content()
line 466 of /mod/dataform/classes/dataform.php: call to mod_dataform\pluginbase\dataformview->display()
line 71 of /mod/dataform/view.php: call to mod_dataform_dataform->display()

as per https://moodle.org/plugins/mod_dataform, it seems there are others experiencing this error, too.

julianrubisch commented 6 years ago

Apperently, the e.type field really doesn't exist.

Commenting out $etypeparams from https://github.com/itamart/moodle-mod_dataform/blob/9d86bab2604706f13e13e26ec839ce7964b0581e/classes/pluginbase/dataformfilter.php#L308

and removing e.type from https://github.com/itamart/moodle-mod_dataform/blob/9d86bab2604706f13e13e26ec839ce7964b0581e/classes/pluginbase/dataformfilter.php#L287

seems to fix the problem?

logan-reynolds commented 5 years ago

We are also seeing this on Totara 12 (essentially Moodle 3.3) running version 2017051502 release 3.3.2 of mod_dataform - any chance this issue will be worked on soon?

logan-reynolds commented 5 years ago

A little more info: I discovered that the plugin does actually work on a fresh plugin install, as the mdl_dataform_entries.type field exists in that case. The problem is that new fields are not getting created during the upgrade steps from a previous mod_dataform version - uninstalling the previous version seems to delete existing dataform instances, so simply uninstalling & reinstalling the latest 3.3.2 version is not a viable workaround.