19declare(strict_types=1);
29 protected \ilDBInterface
$db;
38 if ($this->db->tableColumnExists(
'tst_tests',
'mailnotification')) {
39 $this->db->dropTableColumn(
'tst_tests',
'mailnotification');
41 if ($this->db->tableColumnExists(
'tst_tests',
'mailnottype')) {
42 $this->db->dropTableColumn(
'tst_tests',
'mailnottype');
49 if (!$this->db->tableExists(
'tst_test_settings')) {
52 $this->db->createSequence(
'tst_test_settings');
53 $this->db->addPrimaryKey(
'tst_test_settings', [
'id']);
56 foreach (self::SETTINGS_COLUMNS as $key => $value) {
57 [$column_def] = $value;
60 if (!isset($column_def[
'notnull'])) {
64 $this->db->addTableColumn(
'tst_test_settings', $key, $column_def);
69 if (!$this->db->tableColumnExists(
'tst_tests',
'settings_id')) {
70 $this->db->addTableColumn(
75 $this->db->addForeignKey(
81 ForeignKeyConstraints::NO_ACTION,
82 ForeignKeyConstraints::RESTRICT,
87 if (!$this->db->tableColumnExists(
'tst_test_defaults',
'settings_id')) {
88 $this->db->addTableColumn(
93 $this->db->addForeignKey(
99 ForeignKeyConstraints::NO_ACTION,
100 ForeignKeyConstraints::RESTRICT
103 if (!$this->db->tableColumnExists(
'tst_test_defaults',
'description')) {
104 $this->db->addTableColumn(
110 if (!$this->db->tableColumnExists(
'tst_test_defaults',
'author')) {
111 $this->db->addTableColumn(
119 if (!$this->db->tableExists(
'tst_defaults_marks')) {
120 $this->db->createTable(
121 'tst_defaults_marks',
127 $this->db->addPrimaryKey(
'tst_defaults_marks', [
'defaults_id',
'mark_id']);
129 $this->db->addForeignKey(
130 'test_default_fkey2',
132 'tst_defaults_marks',
133 [
'test_defaults_id'],
135 ForeignKeyConstraints::NO_ACTION,
136 ForeignKeyConstraints::RESTRICT
139 $this->db->addForeignKey(
142 'tst_defaults_marks',
145 ForeignKeyConstraints::NO_ACTION,
153 $columns = [
'reporting_date',
'starting_time',
'ending_time'];
154 foreach ($columns as $column) {
155 $this->db->modifyTableColumn(
'tst_test_settings', $column, [
'length' => 8]);
161 $table =
'qpl_a_cloze';
162 $column =
'answertext';
163 if ($this->db->tableExists($table) && $this->db->tableColumnExists($table, $column)) {
164 $this->db->manipulate(
"UPDATE {$table} SET {$column} = '' WHERE {$column} IS NULL");
165 $this->db->modifyTableColumn($table, $column, [
'default' =>
'',
'notnull' =>
true]);
171 $this->db->manipulate(
172 'DELETE FROM settings WHERE module="assessment" AND keyword="export_essay_qst_with_html"'
178 $this->db->manipulate(
179 'UPDATE tst_rnd_quest_set_qpls SET pool_path = "" WHERE pool_path IS NULL'
181 $this->db->modifyTableColumn(
182 'tst_rnd_quest_set_qpls',
193 $this->db->manipulate(
194 'UPDATE tst_rnd_quest_set_qpls SET pool_title = "" WHERE pool_title IS NULL'
196 $this->db->modifyTableColumn(
197 'tst_rnd_quest_set_qpls',
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
columnIsNullable(array $column_def)