ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTestQuestionPool10DBUpdateSteps.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected ilDBInterface $db;
24
25 public function prepare(ilDBInterface $db): void
26 {
27 $this->db = $db;
28 }
29
30 public function step_1(): void
31 {
32 $this->db->manipulateF('UPDATE qpl_questions SET title=%s WHERE ISNULL(title)', [ilDBConstants::T_TEXT], ['']);
33 $this->db->manipulateF('UPDATE qpl_questions SET description=%s WHERE ISNULL(description)', [ilDBConstants::T_TEXT], ['']);
34 $this->db->manipulateF('UPDATE qpl_questions SET question_text=%s WHERE ISNULL(question_text)', [ilDBConstants::T_TEXT], ['']);
35 $this->db->manipulateF('UPDATE qpl_questions SET lifecycle=%s WHERE ISNULL(lifecycle)', [ilDBConstants::T_TEXT], ['draft']);
36 $this->db->manipulateF('UPDATE qpl_questions SET complete=%s WHERE ISNULL(complete)', [ilDBConstants::T_TEXT], ['1']);
37 $this->db->modifyTableColumn('qpl_questions', 'title', ['notnull' => 1, 'default' => '']);
38 $this->db->modifyTableColumn('qpl_questions', 'description', ['notnull' => 1, 'default' => '']);
39 $this->db->modifyTableColumn('qpl_questions', 'question_text', ['notnull' => 1, 'default' => '']);
40 $this->db->modifyTableColumn('qpl_questions', 'lifecycle', ['notnull' => 1, 'default' => 'draft']);
41 $this->db->modifyTableColumn('qpl_questions', 'complete', ['notnull' => 1, 'default' => '1']);
42 }
43
44 public function step_2(): void
45 {
46 if ($this->db->tableColumnExists('qpl_questionpool', 'show_taxonomies')) {
47 $this->db->dropTableColumn('qpl_questionpool', 'show_taxonomies');
48 }
49 }
50}
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...