h5P new version - upgrade issue

h5P new version - upgrade issue

by Heather P -
Number of replies: 4

Hello

I just tried putting the upgrade patch on for H5P 

There is a new version 2021040800 available!
Release 1.22.0
On a Moodle 3.8.9 on a Windows system with Microsoft SQL.

It gave me an issue
 

DDL sql execution error

Debug info: SQLState: 23000<br>
Error Code: 515<br>
Message: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Cannot insert the value NULL into column 'completionpass', table 'HPPC15455.dbo.mdl_hvp'; column does not allow nulls. UPDATE fails.<br>
SQLState: 01000<br>
Error Code: 3621<br>
Message: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The statement has been terminated.<br>

ALTER TABLE mdl_hvp ALTER COLUMN completionpass SMALLINT NOT NULL
Error code: ddlexecuteerror
Stack trace:
  • line 492 of \lib\dml\moodle_database.php: ddl_change_structure_exception thrown
  • line 324 of \lib\dml\sqlsrv_native_moodle_database.php: call to moodle_database->query_end()
  • line 772 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->query_end()
  • line 77 of \lib\ddl\database_manager.php: call to sqlsrv_native_moodle_database->change_database_structure()
  • line 597 of \lib\ddl\database_manager.php: call to database_manager->execute_sql_arr()
  • line 634 of \lib\ddl\database_manager.php: call to database_manager->change_field_type()
  • line 507 of \mod\hvp\db\upgrade.php: call to database_manager->change_field_notnull()
  • line 598 of \mod\hvp\db\upgrade.php: call to hvp_upgrade_2020080401()
  • line 826 of \lib\upgradelib.php: call to xmldb_hvp_upgrade()
  • line 532 of \lib\upgradelib.php: call to upgrade_plugins_modules()
  • line 1877 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 713 of \admin\index.php: call to upgrade_noncore()
Looks like an issue with the plugin to me, but I'm open to being wrong please.
Thank you
Heather
Average of ratings: -
In reply to Heather P

Re: h5P new version - upgrade issue

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

This might be due #359 Upgrading to 2020080400 creates a field with wrong default value which ominously has the comment "I don't see this breaking anything".

If you're comfortable modifying your Moodle database I suggest:

1. back up the database before making changes, then

2. run the statement:

 UPDATE mdl_hvp SET completionpass = 0 WHERE completionpass IS NULL

I think if you had H5P (mod_hvp) 2020020500 or earlier then upgraded to 2020080400 the definition for mdl_hvp.completionpass was wrong. It's fixed in 2021040800 and presumably the developers didn't expect invalid data (NULLs) in that column but it sounds like your database has this. I don't know enough about mod_hvp to say if this is definitely a plugin bug. But if the above change works maybe this could be reported.

Average of ratings: Useful (1)
In reply to Leon Stringer

Re: h5P new version - upgrade issue

by Heather P -
Hi
Thank you.
Not really comfortable editing the database.
Fortunately it was a test system so my live Moodle is still fine. If it had been my live Moodle and all else failed I would risk it, but as it was a test rig I think I will just go with not putting it on yet whilst I up my skill set.
We were on 1.21.0 - 2020080400 version of H5P, so the fixed version.
We are also on php 7.4 if that makes an impact?
I will try to have a look at the database and see if it does have nulls in it.
If the only way is to tinker in the database then I will have to do it.
Thank you.
Heather
In reply to Heather P

Re: h5P new version - upgrade issue

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Check for NULLs with:

SELECT id, course, name FROM mdl_hvp WHERE completionpass IS NULL;
To my thinking: the test system is where to take risks and learn new things. If you've taken a backup before making changes then you can recover if needed.
In reply to Leon Stringer

Re: h5P new version - upgrade issue

by Heather P -
Hi
After a large delay, I have finally got a grip on the database. The select statement provided by Leon indicates that I had one null row.
The update statement worked beautifully and now the whole upgrade runs smoothly.
Your help is much appreciated.
Thanks