ILIAS  release_8 Revision v8.24
ilStudyProgrammeSettingsTableUpdateSteps.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 public const TABLE_NAME = 'prg_settings';
24 public const TABLE_PROGRESSES = 'prg_usr_progress';
25
26 protected ilDBInterface $db;
27
28 public function prepare(ilDBInterface $db): void
29 {
30 $this->db = $db;
31 }
32
33 public function step_1(): void
34 {
35 $column_name = 'vq_restart_recheck';
36
37 if (!$this->db->tableColumnExists(self::TABLE_NAME, $column_name)) {
38 $this->db->addTableColumn(
39 self::TABLE_NAME,
40 $column_name,
41 [
42 'type' => 'integer',
43 'length' => 1,
44 'default' => 0,
45 'notnull' => false
46 ]
47 );
48 }
49 }
50
51 public function step_2(): void
52 {
53 if (!$this->db->indexExistsByFields(self::TABLE_NAME, ['assignment_id', 'prg_id', 'usr_id'])) {
54 $this->db->dropPrimaryKey(self::TABLE_PROGRESSES);
55 $this->db->addPrimaryKey(
56 self::TABLE_PROGRESSES,
57 [
58 'assignment_id',
59 'prg_id',
60 'usr_id'
61 ]
62 );
63 }
64 }
65}
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...