From 1aa113fd1fa4439b72cf77fe0ada78ec372219e1 Mon Sep 17 00:00:00 2001
From: Paul Holden <paulh@moodle.com>
Date: Mon, 9 Jan 2023 17:21:52 +0000
Subject: [PATCH] MDL-76584 question: correct temporary questionid upgrade
 field.

Pass correct parameter/type in field constructor (`XMLDB_NOTNULL`)
for consistency. This corrects the definition and preserves the
truthyness of the value that was incorrectly passed previously.
---
 lib/db/upgrade.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index f3a34290710..6b299b1ee95 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -2219,7 +2219,7 @@ privatefiles,moodle|/user/files.php';
         // Creating temporary field questionid to populate the data in question version table.
         // This will make sure the appropriate question id is inserted the version table without making any complex joins.
         $table = new xmldb_table('question_bank_entries');
-        $field = new xmldb_field('questionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_TYPE_INTEGER);
+        $field = new xmldb_field('questionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL);
         if (!$dbman->field_exists($table, $field)) {
             $dbman->add_field($table, $field);
         }
@@ -2268,7 +2268,7 @@ privatefiles,moodle|/user/files.php';
 
         // Dropping temporary field questionid.
         $table = new xmldb_table('question_bank_entries');
-        $field = new xmldb_field('questionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_TYPE_INTEGER);
+        $field = new xmldb_field('questionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL);
         if ($dbman->field_exists($table, $field)) {
             $dbman->drop_field($table, $field);
         }