Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to 2020080400 creates a field with wrong default value #359

Closed
ewallah opened this issue Aug 12, 2020 · 2 comments · Fixed by #361
Closed

Upgrading to 2020080400 creates a field with wrong default value #359

ewallah opened this issue Aug 12, 2020 · 2 comments · Fixed by #361

Comments

@ewallah
Copy link

ewallah commented Aug 12, 2020

install.xml:
<FIELD NAME="completionpass" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
upgrade.php
new xmldb_field('completionpass', XMLDB_TYPE_INTEGER, '1', null, null, null, 0, 'timemodified')

=> php admin/cli/check_database_schema.php

-------------------------------------------------------------------------------
hvp
 * column 'completionpass' should be NOT NULL (I)
-------------------------------------------------------------------------------
@thomasmars
Copy link
Member

yes. you're right. I don't see this breaking anything, but it should be fixed. We would love a pull request for with a fix.

@Peterburnett
Copy link
Contributor

It can break some CI systems. Caused me some issues this morning. I can fix this. PR incoming

Peterburnett added a commit to Peterburnett/h5p-moodle-plugin that referenced this issue Aug 20, 2020
Peterburnett added a commit to catalyst/moodle-mod_hvp that referenced this issue Sep 2, 2020
Peterburnett pushed a commit to catalyst/moodle-mod_hvp that referenced this issue Oct 6, 2021
If you had upgraded to mod_hvp version 2020080400 the
mdl_hvp.completionpass definition incorrectly allowed NULLs.  (If you
installed 2020080400 then mdl_hvp.completionpass did not allow NULLs).
The fix for h5p#359 corrected this column definition but didn't change any
NULL values in the data resulting in error "column does not allow
NULLs" when trying to upgrade beyond 2020080400.  This commit changes
any NULLs in this column to 0 prior to the change of the column
definition to "not NULL".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants