ILIAS  release_8 Revision v8.24
ilStudyProgrammeProgressTableUpdateSteps.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22{
23 private const TABLE_NAME = 'prg_usr_progress';
24
25 protected ilDBInterface $db;
26
27 public function prepare(ilDBInterface $db): void
28 {
29 $this->db = $db;
30 }
31
32 public function step_1(): void
33 {
34 $column_name = 'individual';
35
36 if (!$this->db->tableColumnExists(self::TABLE_NAME, $column_name)) {
37 $this->db->addTableColumn(
38 self::TABLE_NAME,
39 $column_name,
40 [
41 "type" => "integer",
42 "length" => 1,
43 "notnull" => true,
44 "default" => 0
45 ]
46 );
47 $query = 'UPDATE ' . self::TABLE_NAME
48 . ' SET ' . $column_name . ' = 1'
49 . ' WHERE last_change_by IS NOT NULL';
50 $this->db->manipulate($query);
51 }
52 }
53
54 public function step_2(): void
55 {
56 $old = "risky_to_fail_mail_send";
57 $new = "sent_mail_risky_to_fail";
58
59 if ($this->db->tableColumnExists(self::TABLE_NAME, $old) && !$this->db->tableColumnExists(self::TABLE_NAME, $new)) {
60 $this->db->renameTableColumn(self::TABLE_NAME, $old, $new);
61 }
62 }
63
64 public function step_3(): void
65 {
66 $column_name = 'sent_mail_expires';
67
68 if (!$this->db->tableColumnExists(self::TABLE_NAME, $column_name)) {
69 $this->db->addTableColumn(
70 self::TABLE_NAME,
71 $column_name,
72 [
73 "type" => "timestamp",
74 "notnull" => false
75 ]
76 );
77 }
78 }
79}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$query